Reputation: 1
When there is timeout the program should move to second question and if time out it should say " your time is over ".
Currently my program runs for the first question but not going to second question.
I have tried many time but it doesn't work.
Int main(){
int time1
char q1[20]
printf("\n")
printf("Enter the malaysia capital name : ");
alarm(30);
scanf("%[^\n]",q1);
if (time != SIGALRM)
{
alarm(0);
printf("The Malaysia capital is : '%s'\n",q1);
printf("\n");
}
int time2
char q1[20]
printf("\n")
printf("Enter the malaysian tallest building : ");
alarm(30);
scanf("%s",q2);
if (time2 != SIGALRM)
{
alarm(0);
printf("Enter the malaysian tallest building is : '%s'\n",q2);
printf("\n");
}
}
Expected :- After time out should move to second question Actual :- Not moving to second question
Upvotes: 0
Views: 466