C++在线运行

版本:

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

                        
以下是用户最新保存的代码
3.2数字字符统计 发布于:2024-06-14 16:59 一款打怪小游戏 发布于:2024-06-12 21:17 操作系统课程设计 发布于:2024-06-10 11:25 遗传算法应用 发布于:2024-06-05 14:21 多路径路由代码 发布于:2024-06-04 12:24 PPO训练 发布于:2024-06-04 12:15 ABC算法过程 发布于:2024-06-04 11:17 混合路由过程 发布于:2024-06-04 10:34 路段选择的过程 发布于:2024-06-04 10:17 中继选择的过程 发布于:2024-06-04 10:12 旅行商问题 发布于:2024-06-03 23:43 路由的过程 发布于:2024-06-03 20:11 Jayden Wu , Menu Programe 发布于:2024-06-03 19:35 添加or在字母中间 发布于:2024-06-02 09:24 计算解冻温度 发布于:2024-06-01 14:53 计算圆柱体表面积esay 发布于:2024-06-01 20:46 计算圆柱体表面积 发布于:2024-05-30 21:48 图片等比例缩放 发布于:2024-06-15 17:48 旅行家问题 发布于:2024-05-28 23:13 C++学习尝试编写 发布于:2024-05-26 16:52 不振刀最新数据库 发布于:2024-05-24 01:24 振刀数据库5.16 发布于:2024-05-24 08:15 重复造轮子 std::array 发布于:2024-05-23 19:02 字符统计,使用字符数组 发布于:2024-05-22 09:52 使用string存储输入的字符串,并对字符串大写、小写、数字和其它字符进行统计 发布于:2024-05-22 09:02 函数使用结构体传递且返回多个参数,交换a和b的值 发布于:2024-05-21 15:13 函数中使用tuple返回多个数值,交换a和b的值 发布于:2024-05-21 15:22 键盘输入的两个数之差的绝对值,输出最大值 发布于:2024-05-21 14:07 计算最短路径 发布于:2024-05-21 11:48 旅行商状态树以及实现代码 发布于:2024-05-21 11:47 找到最短路径 发布于:2024-05-21 11:44 旅行代码块 发布于:2024-05-21 12:10 旅行商问题 发布于:2024-05-21 11:44 TSP问题解答 发布于:2024-05-21 11:32 旅行商问题 发布于:2024-05-21 11:43 旅行商问题 发布于:2024-05-21 09:16 使用while进行累加 发布于:2024-05-20 10:14 C++ iterator 发布于:2024-05-19 14:30 简单测试使用 发布于:2024-05-14 14:19 测试前序遍历 发布于:2024-05-11 15:56 C++代码尝试 发布于:2024-05-10 23:29 C++ classes 发布于:2024-05-10 17:01 哈夫曼编码解码 发布于:2024-05-10 15:25 Cocos缩放图片 发布于:2024-05-30 11:47 数字差值运算 发布于:2024-05-08 14:07 快速排序ss 发布于:2024-05-07 22:02 冒泡排序ss 发布于:2024-05-07 21:52 直接插入排序 发布于:2024-05-07 21:51 float大小端转换 发布于:2024-05-06 16:40 运行hello world 程序 发布于:2024-04-29 15:36 [更多]

作者 我是大神(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(); } 1807

  #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; } 3121

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

  #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; } 1073

  #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; } 3846

  #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; } 5756

  #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; } 4575

  #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; */ } 1959

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

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

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

yout