请教*。*
诸位大侠,请问怎样可以直接终 止一次循环从而直接进行下一次循环呢? 菜鸟咯,什么都不懂,帮帮我啦~~#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
int main()
{
float preparation_time,track_time,match_time,stop_time,temp;
int rider_amount,NO,foul=0,refuse=0,stop_number=0,real_score,finish_score;
char input='1';
clock_t preparation,start,stop,continu,end;
printf("Please input the number of riders:");
rider_amount=getchar()-48;
getchar();
printf("The number of riders is:%d\n",rider_amount);
for(NO=1;NO<=rider_amount;NO++)
{
printf("When The referee say \"start at will\", press \"a\" and then enter. \n");
input=getchar();
getchar();
do{
{if(input=='a'){
preparation = clock();
printf("When the equipage passes the start line press \"b\" and then enter\n");
input=getchar();
getchar();
}
else {printf("Wrong!");
printf("When The referee say \"start at will\", press \"a\" and then enter. \n");
input=getchar();
getchar();
};}
}while(input=='a');
do{
{if(input=='b'){
start = clock();
preparation_time=(start - preparation) / CLK_TCK;
printf("The preparation time was: %f\n",preparation_time );
printf("When the equipage passes the goal line,press \"f\" and then enter\n");
printf("If the player doesn't finish,press \"d\" \nIf the rider pulls down obstacles press \"p\"\nIf the horse refuse to jump,press \"r\"\n");
printf("If the obstacle need repair,press \"s\"\n");
input=getchar();
getchar();}
else {printf("Wrong!");
printf("When the equipage passes the start line press \"b\" and then enter\n");
input=getchar();
getchar();
};}
}while(input=='b');
while(input!='f'){
while(input=='p'){
foul++;
printf("Finish press \"f\"\nStop press \"s\"\nRefuse jump press \"r\"\n");
input=getchar();
getchar();
}
while(input=='r'){
foul++;
refuse++;
[un]if(refuse==2)return main;[/un]
printf("Finish press \"f\"\nStop press \"s\"\nPull down press \"p\"\n");
input=getchar();
getchar();
}
if(input=='s'){
stop=clock();
stop_number++;
printf("When the rider continues press \"c\"\n");
input=getchar();
getchar();
do{
if(input=='c'){continu=clock();
if(stop_number>1)temp=stop_time;
stop_time=(continu - stop) / CLK_TCK+temp;
printf("Stop time is %f",stop_time);
printf("Finish press \"f\"\nPull over press\"p\"\nRefuse press \"r\"\n");
input=getchar();
getchar();}
else {printf("Wrong!");
printf("When the rider continues press \"c\"\n");
input=getchar();
getchar();
};
}while(input=='c');
}
[un]if(input=='d')return main;[/un] }
if(input=='f'){
end=clock();
track_time=(end - start) / CLK_TCK;
printf("The track time was: %f\n",track_time);
match_time=track_time-stop_time;
printf("The match time is:%f",match_time);
};
{
if(match_time<=1200)finish_score=1100;
else finish_score=1100-(match_time-1200);
}
{
if(preparation_time<=45)real_score=finish_score-4*foul;
else real_score=finish_score-4*foul-(preparation_time-45);
}
printf("Rider: %d\n",NO);
printf("His score is: %d\n",real_score);
};
}
就是在两个return main 那里,本来应该是让它进行下一次的循环的 结果搞成了直接退出程序=。=#