for循环的goto必须放在for内部

#include <stdio.h>
#include <iostream>
using namespace std;

int main()
{
   int q = 0;
   for(q =0; q < 3; q++)
   {
      if(q==0)
       {
         cout<<"11111"<<endl;
         goto label;
       }
      if(q == 1)
        {
         cout<<"22222"<<endl;
         goto label;
        }

label:
  cout<<"helower"<<endl;
   }

}

 

posted on 2021-01-27 20:33  lydstory  阅读(332)  评论(0)    收藏  举报

导航