Cod*_*ome 0 c++ xcode for-loop cout
我的问题很简单.我在c ++程序中有一个'for'语句,当我编译时忽略了我的cout.
我正在使用xcode,使用xcode编译,这是我的代码:
#include <iostream>
using namespace std;
int main ()
{
cout << this prints" << endl;
for(int i=0; i>10; i++)
{
cout << "this doesn't" << endl;
}
return 0;
}
Run Code Online (Sandbox Code Playgroud)
问题是什么?
Jam*_*lis 10
for(int i=0; i>10; i++)
Run Code Online (Sandbox Code Playgroud)
如果大于i,0则初始化为仅进入循环体.i10
只要条件i > 10为真,循环就会循环,直到条件i > 10为真. 这是怎么回事在C++中的工作循环: for,while,和do/while.