help on auto count the correct and wrong when the Question and Answer was doneCode:#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int right = 0;
int wrong = 0;
const int QMAX = 10;
main()
{
char cat;
clrscr();
gotoxy(30,10);printf ("Welcome to Trivia");
gotoxy(29,11);printf ("Question and Answer");
gotoxy(30,16);printf ("[PRESS ENTER KEYS]");
getch();
clrscr();
printf ("\n");
printf (" Select Category\n");
printf ("\n");
printf ("\n");
printf ("\n");
printf ("\n");
printf (" [A] HISTORY\n");
printf ("\n");
printf (" [b] GENERAL KNOWLEDGE\n");
printf ("\n");
printf (" [C] ENGLISH\n");
printf ("\n");
printf (" [D] SCIENCE\n");
printf ("\n");
printf (" [E] QUIT\n");
printf (" Enter a category: ");
scanf ("%c",&cat);
switch (cat)
{
case 'A': case 'a':History();break;
case 'B':case 'b':break;
case 'C':case 'c':break;
case 'D':case 'd':break;
case 'E':case 'e':break;
}
}
int History()
{
int qnum = 0;
int count = 0;
char ans;
history:
clrscr();
srand(time(NULL));
for(count = 1; count < 6; count++)
{
qnum = rand() % QMAX;
switch(qnum)
{
case 1:
{
static int foocalled = 0;
if( foocalled == 0 )
{
printf ("\nWhen was the independence of the Philippines declared? \n\n\n");
printf ("[A] June 12, 1898 [C] August 8, 1892 \n\n");
printf ("[b] December 30, 1898 [D] July 4, 1789 \n");
printf (" Answer: ");
scanf ("%c",&ans);
switch (ans)
{
case 'a':right++;printf (" right");break;
default :wrong++;printf (" wrong");break;
};
foocalled = 1;getch();break;
}
}
case 2:
{
static int foocalled = 0;
if( foocalled == 0 )
{
printf ("\nThe Philippines was under Spanish colonial rule for how many years?\n\n\n");
printf ("[A] 222 [C] 584\n\n");
printf ("[b] 198 [D] 333\n");
printf (" Answer: ");
scanf ("%c",&ans);
switch (ans)
{
case 'd':right++;printf (" right");break;
default :wrong++;printf (" wrong");break;
};
foocalled = 1;getch();break;
}
}
case 3:
{
static int foocalled = 0;
if( foocalled == 0 )
{
printf ("\nWhat is the oldest university in the Philippines?\n\n\n");
printf ("[A] University of Sto. Tomas [C] San Juan De Letran \n\n");
printf ("[b] University of San Carlos Cebu [D] Ateneo De Manila \n");
printf (" Answer: ");
scanf ("%c",&ans);
switch (ans)
{
case 'b':right++;printf (" right");break;
default :wrong++;printf (" wrong");break;
};
foocalled = 1;getch();break;
}
}
case 4:
{
static int foocalled = 0;
if( foocalled == 0 )
{
printf ("\nWho was the first Filipino recording artist?\n\n\n");
printf ("[A] Imelda Papin [C] Margi Moran \n\n");
printf ("[b] Pilita Corales [D] Maria Carpena \n");
printf (" Answer: ");
scanf ("%c",&ans);
switch (ans)
{
case 'd':right++;printf (" right");break;
default :wrong++;printf (" wrong");break;
};
foocalled = 1;getch();break;
}
}
case 5:
{
static int foocalled = 0;
if( foocalled == 0 )
{
printf ("\nWho founded the la Liga Filipina?\n\n\n");
printf ("[A] Andres Bonifacio [C] Emilio Aguinaldo\n\n");
printf ("[b] Jose Rizal [D] Emilio Jacinto \n");
printf (" Answer: ");
scanf ("%c",&ans);
switch (ans)
{
case 'b':right++;printf (" right");break;
default :wrong++;printf (" wrong");break;
};
foocalled = 1;getch();break;
}
}
case 6:
{
static int foocalled = 0;
if( foocalled == 0 )
{
printf ("\nWhat is the first word of the 1987 Philippines Constitution?\n\n\n");
printf ("[A] I [C] The \n\n");
printf ("[b] We [D] People \n");
printf (" Answer: ");
scanf ("%c",&ans);
switch (ans)
{
case 'b':right++;printf (" right");break;
default :wrong++;printf (" wrong");break;
};
foocalled = 1;getch();break;
}
}
case 7:
{
static int foocalled = 0;
if( foocalled == 0 )
{
printf ("\nWho was the first Miss Philippines?\n\n\n");
printf ("[A] Margi Moran [C] Evangeline Castro\n\n");
printf ("[b] Mirriam Quiambao [D] Gloria Diaz \n");
printf (" Answer: ");
scanf ("%c",&ans);
switch (ans)
{
case 'c':right++;printf (" right");break;
default :wrong++;printf (" wrong");break;
};
foocalled = 1;getch();break;
}
}
case 8:
{
static int foocalled = 0;
if( foocalled == 0 )
{
printf ("\nWho was the first Filipino Olympian?\n\n\n");
printf ("[A] Paeng Nepomuceno [C] Akiko Thompson\n\n");
printf ("[b] Efren Bata Reyes [D] David Nepomuceno\n");
printf (" Answer: ");
scanf ("%c",&ans);
switch (ans)
{
case 'd':right++;printf (" right");break;
default :wrong++;printf (" wrong");break;
};
foocalled = 1;getch();break;
}
}
case 9:
{
static int foocalled = 0;
if( foocalled == 0 )
{
printf ("\nWhose last words were It is done!\n\n\n");
printf ("[A] Jose Rizal [C] Manuel Quezon\n\n");
printf ("[b] Ninoy Aquino [D] Andres Bonifacio\n");
printf (" Answer: ");
scanf ("%c",&ans);
switch (ans)
{
case 'a':right++;printf (" right");break;
default :wrong++;printf (" wrong");break;
};
foocalled = 1;getch();break;
}
}
case 0:
{
static int foocalled = 0;
if( foocalled == 0 )
{
printf ("\nAfter the death of her husband Andres Bonifacio, Gregoria de Jesus was later married to whom?\n\n\n");
printf ("[A] Franciso Trinidad [C] Julio Nakpil\n\n");
printf ("[b] Jose Calugas [D] Felipe Calderon\n");
printf (" Answer: ");
scanf ("%c",&ans);
switch (ans)
{
case 'c':right++;printf (" right");break;
default :wrong++;printf (" wrong");break;
};
foocalled = 1;getch();break;
}
}
}
}
getch();
return 0;
}
i hope anyone can help me..