C++在线运行

版本:

编辑于 2022-10-22 12:48 累计访问:1801
点击了解高性能代码运行API
运行结果
代码简介
代码仓库
极速运行
终端运行
图形+终端

                        
以下是用户最新保存的代码
拷贝构造函数 发布于:2024-04-15 11:21 解析析构函数 发布于:2024-04-15 11:13 C++int与double除法 发布于:2024-04-12 16:46 移动语意、移动构造、移动赋值示例 发布于:2024-04-12 12:25 二分查找左右边界 发布于:2024-04-11 15:17 #include<iostream> using namespace std; class Base { public: virtual void fn() { cout <<"In Base Class\n";} }; class SubClass : public Base { public: virtual void fn(){ cout <<"In Sub Class\n"; } }; int main() { Base bc; Base *p; SubClass sc; p=&bc; p->fn(); p=&sc; p->fn(); } 发布于:2024-04-11 10:31 汉诺塔算法模拟 发布于:2024-04-10 10:22 static使用 发布于:2024-04-09 17:53 cpp测试0403 发布于:2024-04-03 11:20 泛型代码测试 发布于:2024-03-29 10:06 实验二单向链表 发布于:2024-03-29 09:30 三只小猪谁最重 发布于:2024-03-23 21:06 如何理解虚函数 发布于:2024-03-20 15:22 shared_ptr 智能指针理解 发布于:2024-03-20 11:22 c++数据结构 发布于:2024-03-19 22:10 bfs走迷宫 发布于:2024-04-12 14:22 拷贝构造函数调用顺序 发布于:2024-03-19 16:23 构造函数初始化列表 发布于:2024-03-19 16:03 最富裕小家庭真题代码 发布于:2024-03-18 02:52 这是一个分析数据大小的程序 发布于:2024-03-16 16:27 虚函数、运行时的多态 发布于:2024-03-16 11:00 c++ class试水 发布于:2024-03-15 16:04 常见排序算法 发布于:2024-03-13 14:44 顶顶顶大苏打 发布于:2024-03-09 21:46 自学测试使用 发布于:2024-03-08 10:03 E. 【lqc++152308ST】面积最大差值 发布于:2024-03-07 22:16 生成Delaunay图算法 发布于:2024-03-07 14:59 C语言学习资料 发布于:2024-03-06 23:31 输入一个值 进行计算 发布于:2024-03-08 11:13 sizeof的代码 发布于:2024-03-04 13:52 缩进控制流语句体判断数字的位置 发布于:2024-03-01 17:31 选择排序之随机数组 发布于:2024-02-29 22:28 变分重构有限体积法生成动网格 发布于:2024-02-29 14:37 四面体动网格壳变换 发布于:2024-02-29 14:29 排序算法 - 插入排序 - 希尔排序 发布于:2024-02-29 13:51 动网格生成代码 发布于:2024-02-29 11:16 枚举类型示例 发布于:2024-02-28 18:55 圆的周长面积计算 发布于:2024-02-28 16:59 三个数字挑选出最大的一个 发布于:2024-02-26 14:45 很好用的在线编程网站 发布于:2024-02-23 20:43 C++图的存储——链表 发布于:2024-02-22 17:47 --- c++学习复习 发布于:2024-03-01 17:32 C++ 之 字符判断——快捷函数 发布于:2024-02-21 17:37 NMS例程 发布于:2024-02-21 14:43 力扣小测试 发布于:2024-02-22 17:05 鸡兔同笼免做代码 发布于:2024-02-19 14:13 函数 曼哈顿距离 发布于:2024-02-17 17:16 闰年统计题目 发布于:2024-02-15 18:58 浮点数的四舍五入问题 发布于:2024-02-11 20:44 容器案例--员工分组 发布于:2024-02-07 23:00 [更多]

作者 我是大神(laoguo88)
编辑于:2022-10-22 12:48

#include <iostream> using namespace std; int main() { int n=0,s=0;

for(int ;s&lt;=1000;s+=n) {
    n++;
}
cout &lt;&lt;n&lt;&lt;endl;

//1 2 3 4 5 6
//1+2+3+4=10 


/*
while(s&lt;=1000) {
    n++;
    s+=n;//s = s+n;
}
cout &lt;&lt;n&lt;&lt;endl;
*/

}

提示:本站严禁涉政、违法等无关技术的内容
发送
学习嵌入式的绝佳套件,esp8266开源小电视成品,比自己去买开发板+屏幕还要便宜,省去了焊接不当搞坏的风险。 蜂鸣版+触控升级仅36元,更强的硬件、价格全网最低。

点击购买 固件广场
  #include<iostream> using namespace std; class Base { public: virtual void fn() { cout <<"In Base Class\n";} }; class SubClass : public Base { public: virtual void fn(){ cout <<"In Sub Class\n"; } }; int main() { Base bc; Base *p; SubClass sc; p=&bc; p->fn(); p=&sc; p->fn(); } 460

  #include <iostream> #include <chrono> #include <thread> int main() { std::cout << "延迟输出前的消息" << std::endl; // 设置延迟时间为3秒 std::chrono::seconds delay(3); // 让线程睡眠3秒 std::this_thread::sleep_for(delay); std::cout << "延迟输出后的消息" << std::endl; return 0; } 2328

  #include <iostream> using namespace std; int main() { cout << "Hello World!"; return 0; } 4537

  #include <iostream> #include <cmath> #include <iomanip> using namespace std; int main() { double r; cin>>r; double v=3.14*r*r*r*4.0/3; cout<<fexed<<setprecision(2)<<v; return 0; } 884

  #include <iostream> #include <cmath> #include <iomanip> using namespace std; int main() { double r; cin>>r; double v=3.14*r*r*r*4.0/3; cout<<fexed<<setprecision(2)<<v; return 0; } 3339

  #include <stdio.h> #include <stdlib.h> int main(int argc,char *argv[]) { printf("%s\n",argv[0]);//读取可执行程序(包括路径) /*读取参数*/ int i = 1; while(i < argc) { printf("%s\n",argv[i]); i++; } return 0; } 5223

  #include <stdio.h> #define N 5 int main () { int a[N] = {3,2,1,4,5}; for (int i = 0; i<N-1; i++) { int maxIdx = 0; for (int j=1; j<N-1-i; j++) { if (a[maxIdx] < a[j] ) { maxIdx = j; } } int tmp = a[maxIdx]; a[maxIdx] = a[N-1-i]; a[N-1-i] = tmp; } for (int i=0; i<N-1; i++) { printf("%d",) } return 0; } 4090

  for(int o=0;o<=5;o--) 4276

  #include <iostream> using namespace std; int main() { int n=0,s=0; for(int ;s<=1000;s+=n) { n++; } cout <<n<<endl; //1 2 3 4 5 6 //1+2+3+4=10 /* while(s<=1000) { n++; s+=n;//s = s+n; } cout <<n<<endl; */ } 1802

  #include <iostream> using namespace std; int main() { int day; cout<<"请回答一周有几天:"; cin>>day; cout<<"您的回答是一周有"<<day; return 0; if (day = 7) { cout<<"回答正确"<<endl; } } 697

  int i = 0; int s = (++i)+(i--)+i; System.out.println(s); 258

_.lt
嵌套 while /do...while 循环
while 循环

yout