7章5节一些荒谬的空for循环

来源:互联网 发布:忧郁眼神知乎 编辑:程序博客网 时间:2024/06/07 23:56

#include <iostream>
int main()
{
 using namespace std;
 int counter = 0;
 int max;
    cout <<"pls enter you will print how many hello ?/n" ;
 cin >> max;

 for( ; ; ) //空for 没有初始化 没有条件 没有action  但是还是要有( ; ; )
 {
 
  if (counter < max)
  {
   cout << "hello/n";
    counter++;
  }
  else
   break;
}
return 0;
}

原创粉丝点击