#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]; int randquestion,x,end,numbercorrect,high_score; 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() //creates "Menu portal" //{ //settextstyle(SMALL_FONT,HORIZ_DIR,2); //for(b=7;b>=1;b--) //{ //for(a=1;a<=300;a++) //{ //randomize(); //setclor(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(0); //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 //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<=640;a++) // { // setcolor(a); //Say no to BAD INPUT // outtextxy(222,330,"1,2,3 or 4 please"); // } // 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/Highscores"); // outtextxy(220,240,"4. Exit"); // outtextxy(220,285,"What is your choice?"); // delay(15); // Menu1(); //} //} // // //void Nmintro() //{ //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 hiscore() { ifstream thefile; thefile.open("a:score.txt",ios::in); thefile>>high_name; thefile>>high_score; ofstream outfile; if (numbercorrect>high_score) { cout<<"\nYou have a New high score. What is your first name? "; cin>>high_name; outfile.open("a:score.txt",ios::out); if (outfile) { outfile<0) { cout<<"\nYou lose a point."; numbercorrect=numbercorrect-1; cout<<"You 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(250); gotoxy(1,5); cout<<"b)U"; delay(250); gotoxy(1,6); cout<<"c)E"; delay(250); gotoxy(1,7); cout<<"d)O"; delay(250); gotoxy(1,8); cout<<"e)None of the above"; delay(250); gotoxy(1,10); cout<<"What is your choice? "; cin>>answer; x=2; is_it_correct(); } void Playgame() { clrscr(); question1(); question2(); } void main() { numbercorrect=0; //initgraph (&driver, &mode,"\\TC\\BGI"); //sleep(1); answerkey(); //Nmintro(); //Menuanim(); //Menu1(); Playgame(); }