[C++] c++ goto循环 →→→→→进入此内容的聊天室

来自 , 2019-02-05, 写在 C++, 查看 183 次.
URL http://www.code666.cn/view/d7657583
  1. #include <iostream>
  2.  
  3. int main()
  4. {
  5.     using namespace std;
  6.     int counter = 0; // initialize counter
  7.  
  8. loop:
  9.     counter ++; // top of the loop
  10.     cout << "counter: " << counter << endl;
  11.     if (counter < 5) // test the value
  12.         goto loop; // jump to the top
  13.  
  14.     cout << "Complete. Counter: " << counter << endl;
  15.  
  16.     return 0;
  17. }
  18.  

回复 "c++ goto循环"

这儿你可以回复上面这条便签

captcha