Code:
main()
{
int l;
clrscr();
gotoxy(30,7);printf("[1] QUESTIONS\n");
gotoxy(30,9);printf("[2] QUIT\n\n");
gotoxy(30,13);printf("Choose: ");
scanf("%d",&l);
if(l==1)
easy();
else if(l==2)
exit();
}
easy()
{
int x;
char d[5];
int i=0;
char a[]="a";
char b[]="b";
char c[]="c";
for(x=0;x<=3;x++)
{
clrscr();
gotoxy(10,5);printf("Direction: Choose the letter of the correct answer.");
gotoxy(10,7);printf("1. What two letters are both symbols for 1,000?");
gotoxy(10,9);printf("%s. K and M.",a);
gotoxy(10,11);printf("%s. A and B.",b);
gotoxy(10,13);printf("%s. L and D",c);
gotoxy(10,15);printf("Answer: ");gets(d);
if(strcmp(d,a)==0)
{
gotoxy(12,20);printf("Correct!!!\n");
i=i+1;
gotoxy(12,21);printf("Your score is %d",i);
x=3;
getch();
}
if(strcmp(d,a)!=0)
{
gotoxy(12,20);printf("Wrong!!!\n");
gotoxy(12,21);printf("Life[%d]",x);
getch();
if(x>=3)
{
main();
}
}
}
for(x=1;x<=3;x++)
{
clrscr();
gotoxy(10,7);printf("2. What's short for Binary Digit?");
gotoxy(10,9);printf("%s. BD.",a);
gotoxy(10,11);printf("%s. Bit.",b);
gotoxy(10,13);printf("%s. Digit.",c);
gotoxy(10,15);printf("Answer: ");gets(d);
if(strcmp(d,b)==0)
{
gotoxy(12,20);printf("Correct!!!\n");
i=i+1;
gotoxy(12,21);printf("Your score is %d",i);
x=3;
getch();
}
else
{
gotoxy(12,20);printf("Wrong!!!\n");
gotoxy(12,21);printf("Life[%d]",x);
getch();
if(x>=3)
{
main();
}
}
}
for(x=1;x<=3;x++)
{
clrscr();
gotoxy(10,7);printf("3. What digit did Arab mathematician al-Khwarizmi give to the West\n around 800 B/B.?");
gotoxy(10,10);printf("%s. Zero",a);
gotoxy(10,12);printf("%s. One",b);
gotoxy(10,14);printf("%s. Two",c);
gotoxy(10,16);printf("Answer: ");gets(d);
if(strcmp(d,a)==0)
{
gotoxy(12,20);printf("Correct!!!\n");
i=i+1;
gotoxy(12,21);printf("Your score is %d",i);
x=3;
getch();
}
else
{
gotoxy(12,20);printf("Wrong!!!\n");
gotoxy(12,21);printf("Life[%d]",x);
getch();
if(x>=3)
{
main();
}
}
}
for(x=1;x<=3;x++)
{
clrscr();
gotoxy(10,7);printf("4. What word describes a number system with a base of two?");
gotoxy(10,9);printf("%s. Decimal",a);
gotoxy(10,11);printf("%s. Octal",b);
gotoxy(10,13);printf("%s. Binary",c);
gotoxy(10,15);printf("Answer: ");gets(d);
if(strcmp(d,c)==0)
{
gotoxy(12,20);printf("Correct!!!\n");
i=i+1;
gotoxy(12,21);printf("Your score is %d",i);
x=3;
getch();
}
else
{
gotoxy(12,20);printf("Wrong!!!\n");
gotoxy(12,21);printf("Life[%d]",x);
getch();
if(x>=3)
{
main();
}
}
}
for(x=1;x<=3;x++)
{
clrscr();
gotoxy(10,7);printf("5. How many equal sides does an icosahedron have?");
gotoxy(10,9);printf("%s. Ten",a);
gotoxy(10,11);printf("%s. Twenty",b);
gotoxy(10,13);printf("%s. Thirty",c);
gotoxy(10,15);printf("Answer: ");gets(d);
if(strcmp(d,b)==0)
{
gotoxy(12,20);printf("Correct!!!\n");
i=i+1;
gotoxy(12,21);printf("Your score is %d",i);
x=3;
getch();
}
else
{
gotoxy(12,20);printf("Wrong!!!\n");
gotoxy(12,21);printf("Life[%d]",x);
getch();
if(x>=3)
{
main();
}
}
}
}