#include
int main()
{
flag1: printf("abc");
system("pause");
printf("bca"); //从这里跳回 printf("abc");
goto flag1;
return 0;
}
你可以写一个while或for循环,当然goto也可以,但是个人不建议用goto,注意不要弄成死循环,简单合理的办法是将需要复用的代码写成一个独立的函数,比如:
#include
int main()
{
for(int i=0;i<100;i++){//循环执行100次
reuse("abc");
system("pause");
printf("bca"); //从这里跳回 printf("abc");
}
return 0;
}
goto xxx label