===========================================================================
CODING
#include<all.h>
void main()
{
randomize();
label:
clrscr();
int q1,q2,q3,q4,q21,q22,q23,q24,a1,b1,a2,b2,a3,b3,a4,b4,a21,b21,a22,b22,a23,b23,a24,b24,s=0,S=0;
textcolor(BLUE);
gotoxy(38,1);
cprintf("QUIZ");
gotoxy(1,3);
cprintf("------------------------------------LEVEL 1-------------------------------------");
a1=random(100)+19;
b1=random(100)+18;
textcolor(13);
gotoxy(10,5);
cprintf("Q.1)Add %d and %d ?",a1,b1);
gotoxy(14,7);
cprintf("Answer¯ ");
cin>>q1;
a2=random(30);
b2=random(30);
gotoxy(40,5);
cprintf("Q.2)Multiply %d and %d ?",a2,b2);
gotoxy(44,7);
cprintf("Answer¯ ");
cin>>q2;
a3=-random(100)+83;
b3=random(100)+4;
gotoxy(10,10);
cprintf("Q.3)Divide %d by %d ?",a3,b3);
gotoxy(14,12);
cprintf("Answer¯ ");
cin>>q3;
a4=-random(1000);
b4=random(1000);
gotoxy(40,10);
cprintf("Q.4)Multiply (%d+%d) and (%d-%d) ?",a4,b4,a4,b4);
gotoxy(44,12);
cprintf("Answer¯ ");
cin>>q4;
if(q1==(a1+b1))
{
gotoxy(14,7);
textcolor(GREEN);
cprintf("Answer¯ %d",q1);
s=s+1;
}
else
{
gotoxy(14,7);
textcolor(RED);
cprintf("Answer¯ %d",q1);
}
if(q2==(a2*b2))
{
gotoxy(44,7);
textcolor(GREEN);
cprintf("Answer¯ %d",q2);
s=s+1;
}
else
{
gotoxy(44,7);
textcolor(RED);
cprintf("Answer¯ %d",q2);
}
if(q3==a3/b3)
{
gotoxy(14,12);
textcolor(GREEN);
cprintf("Answer¯ %d",q3);
s=s+1;
}
else
{
gotoxy(14,12);
textcolor(RED);
cprintf("Answer¯ %d",q3);
}
if(q4==a4*b4)
{
gotoxy(44,12);
textcolor(GREEN);
cprintf("Answer¯ %d",q4);
s=s+1;
}
else
{
gotoxy(44,12);
textcolor(RED);
cprintf("Answer¯ %d",q4);
}
getch();
textcolor(WHITE);
gotoxy(44,12);
textcolor(YELLOW);
gotoxy(28,13);
cprintf("Your Level-1 Score is: %d",s);
getch();
if(s<=2)
{
gotoxy(19,13);
cprintf("You FAIL! Please wait Level-1 is loading again....");
delay(3000);
goto label;
}
else
{
}
label1:
textcolor(13);
gotoxy(1,14);
cprintf("------------------------------------LEVEL 2-------------------------------------");
a21=random(100)+19;
b21=random(100)+15;
textcolor(13);
gotoxy(10,16);
printf("Q.1)Find Remainder: %d/%d?",a21,b21);
gotoxy(14,18);
printf("Answer¯ ");
cin>>q21;
a22=random(100);
b22=random(100);
gotoxy(40,16);
printf("Q.2)Solve (%d+%d)ý?",a22,b22);
gotoxy(44,18);
printf("Answer¯ ");
cin>>q22;
a23=-random(100)+83;
b23=random(100)+47;
gotoxy(10,21);
printf("Q.3)Solve (%d-%d)ý-(%d+%d)ý?",a23,b23,a23,b23);
gotoxy(14,23);
printf("Answer¯ ");
cin>>q23;
a24=-random(1000);
b24=random(1000);
gotoxy(40,21);
printf("Q.4)Solve: (%dý-%dý)+(%d+%d)ý?",a24,b24,a24,b24);
gotoxy(44,23);
printf("Answer¯ ");
cin>>q24;
if(q21==a21%b21)
{
gotoxy(14,18);
textcolor(GREEN);
cprintf("Answer¯ %d",q21);
S=S+1;
}
else
{
gotoxy(14,18);
textcolor(RED);
cprintf("Answer¯ %d",q21);
}
if(q22==pow(a22+b22,2))
{
gotoxy(44,18);
textcolor(GREEN);
cprintf("Answer¯ %d",q22);
S=S+1;
}
else
{
gotoxy(44,18);
textcolor(RED);
cprintf("Answer¯ %d",q22);
}
if(q23==pow(a23-b23,2)-pow(a23+b23,2))
{
gotoxy(14,23);
textcolor(GREEN);
cprintf("Answer¯ %d",q23);
S=S+1;
}
else
{
gotoxy(14,23);
textcolor(RED);
cprintf("Answer¯ %d",q23);
}
if(q24==pow(a24,2)-pow(b24,2)+pow(a24+b24,2))
{
gotoxy(44,23);
textcolor(GREEN);
cprintf("Answer¯ %d",q24);
S=S+1;
}
else
{
gotoxy(44,23);
textcolor(RED);
cprintf("Answer¯ %d",q24);
}
getch();
textcolor(WHITE);
gotoxy(44,23);
textcolor(YELLOW);
gotoxy(28,24);
cprintf("Your Level-2 Score is: %d",S);
getch();
if(S>2)
{
gotoxy(29,25);
cprintf("Your Total Score is: %d",S+s);
}
else
{
gotoxy(19,25);
cprintf("You FAIL! Please wait Level-2 is loading again....");
delay(3000);
goto label1;
}
textcolor(WHITE);
gotoxy(50,25);
getch();
}
CODING
#include<all.h>
void main()
{
randomize();
label:
clrscr();
int q1,q2,q3,q4,q21,q22,q23,q24,a1,b1,a2,b2,a3,b3,a4,b4,a21,b21,a22,b22,a23,b23,a24,b24,s=0,S=0;
textcolor(BLUE);
gotoxy(38,1);
cprintf("QUIZ");
gotoxy(1,3);
cprintf("------------------------------------LEVEL 1-------------------------------------");
a1=random(100)+19;
b1=random(100)+18;
textcolor(13);
gotoxy(10,5);
cprintf("Q.1)Add %d and %d ?",a1,b1);
gotoxy(14,7);
cprintf("Answer¯ ");
cin>>q1;
a2=random(30);
b2=random(30);
gotoxy(40,5);
cprintf("Q.2)Multiply %d and %d ?",a2,b2);
gotoxy(44,7);
cprintf("Answer¯ ");
cin>>q2;
a3=-random(100)+83;
b3=random(100)+4;
gotoxy(10,10);
cprintf("Q.3)Divide %d by %d ?",a3,b3);
gotoxy(14,12);
cprintf("Answer¯ ");
cin>>q3;
a4=-random(1000);
b4=random(1000);
gotoxy(40,10);
cprintf("Q.4)Multiply (%d+%d) and (%d-%d) ?",a4,b4,a4,b4);
gotoxy(44,12);
cprintf("Answer¯ ");
cin>>q4;
if(q1==(a1+b1))
{
gotoxy(14,7);
textcolor(GREEN);
cprintf("Answer¯ %d",q1);
s=s+1;
}
else
{
gotoxy(14,7);
textcolor(RED);
cprintf("Answer¯ %d",q1);
}
if(q2==(a2*b2))
{
gotoxy(44,7);
textcolor(GREEN);
cprintf("Answer¯ %d",q2);
s=s+1;
}
else
{
gotoxy(44,7);
textcolor(RED);
cprintf("Answer¯ %d",q2);
}
if(q3==a3/b3)
{
gotoxy(14,12);
textcolor(GREEN);
cprintf("Answer¯ %d",q3);
s=s+1;
}
else
{
gotoxy(14,12);
textcolor(RED);
cprintf("Answer¯ %d",q3);
}
if(q4==a4*b4)
{
gotoxy(44,12);
textcolor(GREEN);
cprintf("Answer¯ %d",q4);
s=s+1;
}
else
{
gotoxy(44,12);
textcolor(RED);
cprintf("Answer¯ %d",q4);
}
getch();
textcolor(WHITE);
gotoxy(44,12);
textcolor(YELLOW);
gotoxy(28,13);
cprintf("Your Level-1 Score is: %d",s);
getch();
if(s<=2)
{
gotoxy(19,13);
cprintf("You FAIL! Please wait Level-1 is loading again....");
delay(3000);
goto label;
}
else
{
}
label1:
textcolor(13);
gotoxy(1,14);
cprintf("------------------------------------LEVEL 2-------------------------------------");
a21=random(100)+19;
b21=random(100)+15;
textcolor(13);
gotoxy(10,16);
printf("Q.1)Find Remainder: %d/%d?",a21,b21);
gotoxy(14,18);
printf("Answer¯ ");
cin>>q21;
a22=random(100);
b22=random(100);
gotoxy(40,16);
printf("Q.2)Solve (%d+%d)ý?",a22,b22);
gotoxy(44,18);
printf("Answer¯ ");
cin>>q22;
a23=-random(100)+83;
b23=random(100)+47;
gotoxy(10,21);
printf("Q.3)Solve (%d-%d)ý-(%d+%d)ý?",a23,b23,a23,b23);
gotoxy(14,23);
printf("Answer¯ ");
cin>>q23;
a24=-random(1000);
b24=random(1000);
gotoxy(40,21);
printf("Q.4)Solve: (%dý-%dý)+(%d+%d)ý?",a24,b24,a24,b24);
gotoxy(44,23);
printf("Answer¯ ");
cin>>q24;
if(q21==a21%b21)
{
gotoxy(14,18);
textcolor(GREEN);
cprintf("Answer¯ %d",q21);
S=S+1;
}
else
{
gotoxy(14,18);
textcolor(RED);
cprintf("Answer¯ %d",q21);
}
if(q22==pow(a22+b22,2))
{
gotoxy(44,18);
textcolor(GREEN);
cprintf("Answer¯ %d",q22);
S=S+1;
}
else
{
gotoxy(44,18);
textcolor(RED);
cprintf("Answer¯ %d",q22);
}
if(q23==pow(a23-b23,2)-pow(a23+b23,2))
{
gotoxy(14,23);
textcolor(GREEN);
cprintf("Answer¯ %d",q23);
S=S+1;
}
else
{
gotoxy(14,23);
textcolor(RED);
cprintf("Answer¯ %d",q23);
}
if(q24==pow(a24,2)-pow(b24,2)+pow(a24+b24,2))
{
gotoxy(44,23);
textcolor(GREEN);
cprintf("Answer¯ %d",q24);
S=S+1;
}
else
{
gotoxy(44,23);
textcolor(RED);
cprintf("Answer¯ %d",q24);
}
getch();
textcolor(WHITE);
gotoxy(44,23);
textcolor(YELLOW);
gotoxy(28,24);
cprintf("Your Level-2 Score is: %d",S);
getch();
if(S>2)
{
gotoxy(29,25);
cprintf("Your Total Score is: %d",S+s);
}
else
{
gotoxy(19,25);
cprintf("You FAIL! Please wait Level-2 is loading again....");
delay(3000);
goto label1;
}
textcolor(WHITE);
gotoxy(50,25);
getch();
}
===========================================================================
No comments:
Post a Comment