![](/img/trans.png)
[英]Dev C++ keeps crashing when I run this code. I cannot figure out why
[英]I cannot figure out why this code will not work
我的代码有什么问题?
int main() {
for(int i=0; i>=5; ++i){
cout << "Hello World! \n";
}
return 0;
}
它应该显示“Hello World”5 次。
你需要做的就是用<=
替换>=
因为你说i
已经大于 5 了。 此外,使用此 for 循环,它将显示“Hello World”6 次,因为您让i
从 0 开始。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.