I want to make a progamme of quiz format given:
#include<stdio.h>
#include<ctype.h>
main()
{
char character,character1;
clrscr();
{
printf("WHO INVENTED THE LIGHT BULB?\n");
printf("(a) Thomas Edison (b) Gerarled Philips\n");
printf("(c) Nicolous Tesla (d) Volta\n");
character=getchar();
if(character== 'a')
printf("YOUR ANSWER IS RIGHT!\n");
else
printf("SORRY!\n");
}
printf("end\n");
{
printf("WHO INVENTED THE LIGHT BULB?\n");
printf("(a) Thomas Edison (b) Gerarled Philips\n");
printf("(c) Nicolous Tesla (d) Volta\n");
character1=getchar();
if(character1== 'a')
printf("YOUR ANSWER IS RIGHT!");
else
printf("SORRY!");
}
switch(getch())
case 'x': exit();
return 0 ;
}
(Ignore that both quastions are same, they can be different too.)
Now, the problem with the programme is that it runs well only up to one quastion and answer only and after finishing the checking of the first answer ( RIGHT or SORRY) it print the second quastion and without scaning it's response it directly deliver (""SORRY") message which supposed to be only after saning and checking the answer only, so, please some one help me!!
#include<stdio.h>
#include<ctype.h>
main()
{
char character,character1;
clrscr();
{
printf("WHO INVENTED THE LIGHT BULB?\n");
printf("(a) Thomas Edison (b) Gerarled Philips\n");
printf("(c) Nicolous Tesla (d) Volta\n");
character=getchar();
if(character== 'a')
printf("YOUR ANSWER IS RIGHT!\n");
else
printf("SORRY!\n");
}
printf("end\n");
{
printf("WHO INVENTED THE LIGHT BULB?\n");
printf("(a) Thomas Edison (b) Gerarled Philips\n");
printf("(c) Nicolous Tesla (d) Volta\n");
character1=getchar();
if(character1== 'a')
printf("YOUR ANSWER IS RIGHT!");
else
printf("SORRY!");
}
switch(getch())
case 'x': exit();
return 0 ;
}
(Ignore that both quastions are same, they can be different too.)
Now, the problem with the programme is that it runs well only up to one quastion and answer only and after finishing the checking of the first answer ( RIGHT or SORRY) it print the second quastion and without scaning it's response it directly deliver (""SORRY") message which supposed to be only after saning and checking the answer only, so, please some one help me!!