#include #include #include #include #include #include #include #include #include #include #include #include #include //variable declarations go here char menuchoice [3]; int driver = VGA; int mode = VGAHI; float a,b,choice=1; char answer[1], key[20] [60], high_name[60], name[10]; int randquestion,x,end,numbercorrect,high_score; int questconstdelay=250; void answerkey() //Loads predefined answers from textfile { ifstream thefile; thefile.open("a:Answerky.txt",ios::in); x=1; thefile>>key[x]; do { x=x+1; thefile>>key[x]; } while(!thefile.eof()); thefile.close(); end=x; } void Menuanim() { initgraph (&driver, &mode,"\\TC\\BGI"); for(b=7;b>=1;b--) { for(a=1;a<=300;a++) { randomize(); setcolor(b); circle(cos(a)*200+320,sin(a)*200+240,30); line(320,240,sin(a)*200+320,cos(a)*200+240); delay(0); } } for(a=1;a<=300;a++) { setcolor(BLACK); line(320,240,sin(a)*200+320,cos(a)*200+240); delay(b+3); } //spins letters in a very small circle while changing color, then prints out white text settextstyle(SMALL_FONT,HORIZ_DIR,2); for(b=3;b>=1;b=b-1) { for(a=1;a<=300;a=a+5) { setcolor(b); outtextxy(cos(a)*8+220,sin(a)*8+140,"Super Misc Quiz 2001"); delay(5); } for(a=1;a<=300;a=a+5) { setcolor(0); outtextxy(cos(a)*8+220,sin(a)*8+140,"Super Misc Quiz 2001"); delay(5); } } //Very basic...Creates "growing letters" effect setcolor(15); settextstyle(SMALL_FONT,HORIZ_DIR,2); outtextxy(220,140,"Super Misc Quiz 2001"); delay(50); setcolor(0); settextstyle(SMALL_FONT,HORIZ_DIR,2); outtextxy(220,140,"Super Misc Quiz 2001"); setcolor(15); settextstyle(SMALL_FONT,HORIZ_DIR,3); outtextxy(220,140,"Super Misc Quiz 2001"); delay(50); setcolor(0); settextstyle(SMALL_FONT,HORIZ_DIR,3); outtextxy(220,140,"Super Misc Quiz 2001"); setcolor(15); settextstyle(SMALL_FONT,HORIZ_DIR,4); outtextxy(220,140,"Super Misc Quiz 2001"); delay(50); setcolor(0); settextstyle(SMALL_FONT,HORIZ_DIR,4); outtextxy(220,140,"Super Misc Quiz 2001"); setcolor(15); settextstyle(SMALL_FONT,HORIZ_DIR,5); outtextxy(220,140,"Super Misc Quiz 2001"); delay(50); setcolor(0); settextstyle(SMALL_FONT,HORIZ_DIR,5); outtextxy(220,140,"Super Misc Quiz 2001"); setcolor(15); settextstyle(SMALL_FONT,HORIZ_DIR,6); outtextxy(220,140,"Super Misc Quiz 2001"); delay(400); } void Menu1() //The menu....with some effects :) { for(a=0;a<=15;a++) { setcolor(a); outtextxy(220,180,"1. Take the quiz!"); delay(15); } for(a=0;a<=15;a++) { setcolor(a); outtextxy(220,200,"2. Instructions.."); delay(15); } for(a=0;a<=15;a++) { setcolor(a); outtextxy(220,220,"3. Credits"); delay(15); } for(a=0;a<=15;a++) { setcolor(a); outtextxy(220,240,"4. Exit"); delay(15); } for(a=0;a<=15;a++) { setcolor(a); outtextxy(220,285,"What is your choice?"); delay(15); } gotoxy(54,19); gets(menuchoice); choice=atoi(menuchoice); if ((choice!=1) && (choice!=2) && (choice!=3) && (choice!=4)) { for(a=220;a<=393;a++) { setcolor(RED); line(a,333,a,349); } for(a=0;a<=32;a++) { setcolor(a); //Say no to BAD INPUT outtextxy(222,330,"1,2,3 or 4 please"); delay(90); } for(a=220;a<=393;a++) { setcolor(0); line(a,333,a,349); } setcolor(0); outtextxy(222,330,"1,2,3 or 4 please"); setcolor(0); outtextxy(220,180,"1. Take the quiz!"); outtextxy(220,200,"2. Instructions.."); outtextxy(220,220,"3. Credits"); outtextxy(220,240,"4. Exit"); outtextxy(220,285,"What is your choice? "); delay(15); Menu1(); } } void Nmintro() { initgraph (&driver, &mode,"\\TC\\BGI"); settextstyle(SMALL_FONT, HORIZ_DIR,8); sleep(2); for(a=0;a<=100;a++) { setcolor(14); outtextxy(a,67,"A"); delay(1); } for(a=0;a<=100;a++) { setcolor(0); outtextxy(a,67,"A"); } setcolor(15); outtextxy(a,67,"A"); for(a=0;a<=115;a++) { setcolor(14); outtextxy(a,67,"l"); delay(1); } for(a=0;a<=115;a++) { setcolor(0); outtextxy(a,67,"l"); } setcolor(15); outtextxy(100,67,"Al"); for(a=0;a<=130;a++) { setcolor(14); outtextxy(a,67,"f"); delay(1); } for(a=0;a<=130;a++) { setcolor(0); outtextxy(a,67,"f"); } setcolor(15); outtextxy(100,67,"Alf"); for(a=0;a<=145;a++) { setcolor(14); outtextxy(a,67,"o"); delay(1); } for(a=0;a<=145;a++) { setcolor(0); outtextxy(a,67,"o"); } setcolor(15); outtextxy(100,67,"Alfo"); for(a=0;a<=160;a++) { setcolor(14); outtextxy(a,67,"n"); delay(1); } for(a=0;a<=160;a++) { setcolor(0); outtextxy(a,67,"n"); } setcolor(15); outtextxy(100,67,"Alfon"); for(a=0;a<=175;a++) { setcolor(14); outtextxy(a,67,"s"); delay(1); } for(a=0;a<=175;a++) { setcolor(0); outtextxy(a,67,"s"); } setcolor(15); outtextxy(100,67,"Alfons"); for(a=0;a<=190;a++) { setcolor(14); outtextxy(a,67,"o"); delay(1); } for(a=0;a<=190;a++) { setcolor(0); outtextxy(a,67,"o"); } setcolor(15); outtextxy(100,67,"Alfonso"); delay(400); for(a=0;a<=530;a++) { setcolor(a); outtextxy(130,98,"Presents"); delay(3); } setcolor(15); outtextxy(130,98,"Presents"); setcolor(0); outtextxy(100,67,"Alfonso"); outtextxy(130,98,"Presents"); for (a=0; a<=16; a++) { cleardevice(); setbkcolor(a); } setbkcolor(0); } void info() { closegraph(); clrscr(); cout<<"Please enter your first name.(10 characters or less, no spaces)\n\n"; cout<<"\nName: "; cin>>name; if (strlen(name)>10) { cout<<"\nIm sorry, you did not follow directions..10 CHARS OR LESS, NO SPACES. "; cout<<"\nLet's try again..........Press any key."; getch(); info(); } if (strcmp(high_name,name)==0) { cout<<"\nWelcome back, mr(s). high score holder"; } } void hiscore() { ifstream thefile; thefile.open("a:score.txt",ios::in); thefile>>high_name; thefile>>high_score; ofstream outfile; if (numbercorrect>high_score) { clrscr(); cout<<"Congratulations, "<0) { cout<<"\nYou lose a point."; numbercorrect=numbercorrect-1; cout<<"\nYou now have "<>answer; x=1; is_it_correct(); } void question2() { clrscr(); cout<<"What is the next letter in following sequence? O T T F F S S "; //E for Eight: O=one T=two T=three....etc delay(1000); gotoxy(1,4); cout<<"a)T"; delay(questconstdelay); gotoxy(1,5); cout<<"b)U"; delay(questconstdelay); gotoxy(1,6); cout<<"c)E"; delay(questconstdelay); gotoxy(1,7); cout<<"d)O"; delay(questconstdelay); gotoxy(1,8); cout<<"e)None of the above"; delay(questconstdelay); gotoxy(1,10); cout<<"What is your choice? "; cin>>answer; x=2; is_it_correct(); } void question3() { clrscr(); cout<<"Which is worth more: 1990 american dollar bills or 1970 american dollar bills? "; //1,990 is 20 more than 1,970 so the answer is 1990 delay(1000); gotoxy(1,4); cout<<"a)They are both worth the same."; delay(questconstdelay); gotoxy(1,5); cout<<"b)1970 american dollar bills."; delay(questconstdelay); gotoxy(1,6); cout<<"c)1990 american dollar bills."; delay(questconstdelay); gotoxy(1,7); cout<<"d)Depends on the country"; delay(questconstdelay); gotoxy(1,8); cout<<"e)None of the above"; delay(questconstdelay); gotoxy(1,10); cout<<"What is your choice? "; cin>>answer; x=3; is_it_correct(); } void question4() { clrscr(); cout<<"What would happen if an irresistible force (i.e. a cannonball that cannot be\nstopped by anything) met and immovable object (i.e. a wall that cannot be\nmoved by anything)? "; //the answer is B delay(1000); gotoxy(1,5); cout<<"a)They would cause a paradox that would end the universe."; delay(questconstdelay); gotoxy(1,6); cout<<"b)Nothing, it is impossible for both objects to co-exist."; delay(questconstdelay); gotoxy(1,7); cout<<"c)They would stop each other because they have equal force."; delay(questconstdelay); gotoxy(1,8); cout<<"d)The larger object would stay, while the smaller object would break."; delay(questconstdelay); gotoxy(1,9); cout<<"e)None of the above"; delay(questconstdelay); gotoxy(1,11); cout<<"What is your choice? "; cin>>answer; x=4; is_it_correct(); } void question5() { clrscr(); cout<<"How many of each animal did moses take on the ark? "; //the answer is e, moses didnt have an ark, noah did delay(1000); gotoxy(1,5); cout<<"a)One of each"; delay(questconstdelay); gotoxy(1,6); cout<<"b)Two of each"; delay(questconstdelay); gotoxy(1,7); cout<<"c)Three of each"; delay(questconstdelay); gotoxy(1,8); cout<<"d)Four of each"; delay(questconstdelay); gotoxy(1,9); cout<<"e)None of the above"; delay(questconstdelay); gotoxy(1,11); cout<<"What is your choice? "; cin>>answer; x=5; is_it_correct(); } void question6() { clrscr(); cout<<"How do you stop a horse? "; //the answer is a, a horse will not move without seeing delay(1000); gotoxy(1,5); cout<<"a)Cover its eyes"; delay(questconstdelay); gotoxy(1,6); cout<<"b)Shoot it in the head"; delay(questconstdelay); gotoxy(1,7); cout<<"c)Hit it with your cowboy boot"; delay(questconstdelay); gotoxy(1,8); cout<<"d)Pull gently on the mane"; delay(questconstdelay); gotoxy(1,9); cout<<"e)None of the above"; delay(questconstdelay); gotoxy(1,11); cout<<"What is your choice? "; cin>>answer; x=6; is_it_correct(); } void question7() { clrscr(); cout<<"Which is correct to say, 'The yolk of the egg are white' or, 'The yolk of the\negg is white'? "; //the answer is B delay(1000); gotoxy(1,5); cout<<"a)The yolk of the egg is white"; delay(questconstdelay); gotoxy(1,6); cout<<"b)The yolk of the egg are white"; delay(questconstdelay); gotoxy(1,7); cout<<"c)Depends on the number of yolks"; delay(questconstdelay); gotoxy(1,8); cout<<"d)Eggs do not have yolks, they have yokes"; delay(questconstdelay); gotoxy(1,9); cout<<"e)None of the above"; delay(questconstdelay); gotoxy(1,11); cout<<"What is your choice? "; cin>>answer; x=7; is_it_correct(); } void question8() { clrscr(); cout<<"What is the capital of Brazil? "; //the answer is B delay(1000); gotoxy(1,5); cout<<"a)Lima"; delay(questconstdelay); gotoxy(1,6); cout<<"b)Bogota"; delay(questconstdelay); gotoxy(1,7); cout<<"c)Brasilia"; delay(questconstdelay); gotoxy(1,8); cout<<"d)Rio"; delay(questconstdelay); gotoxy(1,9); cout<<"e)None of the above"; delay(questconstdelay); gotoxy(1,11); cout<<"What is your choice? "; cin>>answer; x=8; is_it_correct(); } void question9() { clrscr(); cout<<"If you were to take two apples from 9, how many would you have? "; //the answer is B delay(1000); gotoxy(1,5); cout<<"a)2"; delay(questconstdelay); gotoxy(1,6); cout<<"b)9"; delay(questconstdelay); gotoxy(1,7); cout<<"c)7"; delay(questconstdelay); gotoxy(1,8); cout<<"d)You cant take apples"; delay(questconstdelay); gotoxy(1,9); cout<<"e)None of the above"; delay(questconstdelay); gotoxy(1,11); cout<<"What is your choice? "; cin>>answer; x=9; is_it_correct(); } void question10() { clrscr(); cout<<"If nine thousand, nine hundred nine dollars is written as $9,909, how should\ntwelve thousand, twelve hundred twelve dollars be written? "; //the answer is B delay(1000); gotoxy(1,5); cout<<"a)12212"; delay(questconstdelay); gotoxy(1,6); cout<<"b)13212"; delay(questconstdelay); gotoxy(1,7); cout<<"c)13200"; delay(questconstdelay); gotoxy(1,8); cout<<"d)Impossible number"; delay(questconstdelay); gotoxy(1,9); cout<<"e)None of the above"; delay(questconstdelay); gotoxy(1,11); cout<<"What is your choice? "; cin>>answer; x=10; is_it_correct(); } void question11() { clrscr(); cout<<"When can you add two to Eleven and end up with one? "; //the answer is B delay(1000); gotoxy(1,5); cout<<"a)You can't"; delay(questconstdelay); gotoxy(1,6); cout<<"b)On a clock"; delay(questconstdelay); gotoxy(1,7); cout<<"c)With hotdogs"; delay(questconstdelay); gotoxy(1,8); cout<<"d)Dirty joke...."; delay(questconstdelay); gotoxy(1,9); cout<<"e)None of the above"; delay(questconstdelay); gotoxy(1,11); cout<<"What is your choice? "; cin>>answer; x=11; is_it_correct(); } void question12() { clrscr(); cout<<"If it takes six men six days to dig six holes, how long will it take one man\nto dig half a hole? "; //the answer is B delay(1000); gotoxy(1,5); cout<<"a)A hole is a hole"; delay(questconstdelay); gotoxy(1,6); cout<<"b)12 days"; delay(questconstdelay); gotoxy(1,7); cout<<"c)Same amount of time, same ratio"; delay(questconstdelay); gotoxy(1,8); cout<<"d)One man can't dig"; delay(questconstdelay); gotoxy(1,9); cout<<"e)None of the above"; delay(questconstdelay); gotoxy(1,11); cout<<"What is your choice? "; cin>>answer; x=12; is_it_correct(); } void question13() { clrscr(); cout<<"I am a man. If Jason's son is my son's father, what relationship am I to\nJason? "; //the answer is A delay(1000); gotoxy(1,5); cout<<"a)His son"; delay(questconstdelay); gotoxy(1,6); cout<<"b)His grandfather"; delay(questconstdelay); gotoxy(1,7); cout<<"c)His dad"; delay(questconstdelay); gotoxy(1,8); cout<<"d)His father-in-law"; delay(questconstdelay); gotoxy(1,9); cout<<"e)None of the above"; delay(questconstdelay); gotoxy(1,11); cout<<"What is your choice? "; cin>>answer; x=13; is_it_correct(); } void question14() { clrscr(); cout<<"What is the value of one-half of two-thirds of three-quarters of four-fifths\nof five-sixths of six-sevenths of seven-eighths of eight-ninths of nine-tenths\nof one thousand? "; //the answer is A delay(1000); gotoxy(1,5); cout<<"a)200"; delay(questconstdelay); gotoxy(1,6); cout<<"b)100"; delay(questconstdelay); gotoxy(1,7); cout<<"c)10"; delay(questconstdelay); gotoxy(1,8); cout<<"d)1000"; delay(questconstdelay); gotoxy(1,9); cout<<"e)None of the above"; delay(questconstdelay); gotoxy(1,11); cout<<"What is your choice? "; cin>>answer; x=14; is_it_correct(); } void question15() { clrscr(); cout<<"How many times can you subtract the number 5 from 25? "; //the answer is A delay(1000); gotoxy(1,5); cout<<"a)4 times"; delay(questconstdelay); gotoxy(1,6); cout<<"b)Once"; delay(questconstdelay); gotoxy(1,7); cout<<"c)5 times"; delay(questconstdelay); gotoxy(1,8); cout<<"d)25 times"; delay(questconstdelay); gotoxy(1,9); cout<<"e)None of the above"; delay(questconstdelay); gotoxy(1,11); cout<<"What is your choice? "; cin>>answer; x=15; is_it_correct(); } void question16() { clrscr(); cout<<"If three cats catch three mice in three minutes, how many cats would be needed\nto catch 100 mice in 100 minutes? "; //the answer is A delay(1000); gotoxy(1,5); cout<<"a)Three"; delay(questconstdelay); gotoxy(1,6); cout<<"b)One hundred"; delay(questconstdelay); gotoxy(1,7); cout<<"c)300"; delay(questconstdelay); gotoxy(1,8); cout<<"d)33.333333"; delay(questconstdelay); gotoxy(1,9); cout<<"e)None of the above"; delay(questconstdelay); gotoxy(1,11); cout<<"What is your choice? "; cin>>answer; x=16; is_it_correct(); } void order1() { question1(); question2(); question3(); question4(); question5(); question6(); question7(); question8(); question9(); question10(); question11(); question12(); question13(); question14(); question15(); question16(); clrscr(); cout<<"You have finished the quiz....\n"; cout<<"Your score was...."<