21天学通c++之7.5 while 循环
#include <iostream>
using namespace std;
int main()
{
int counter=0;
while(true) //条件永远为true,风格不好
{
counter++;
if(counter>10)
break;
}
cout<<"counter: "<<counter<<endl;
return 0;
}
using namespace std;
int main()
{
int counter=0;
while(true) //条件永远为true,风格不好
{
counter++;
if(counter>10)
break;
}
cout<<"counter: "<<counter<<endl;
return 0;
}