You are on page 1of 7

//The Infinite Knowledge Quiz Program

#include<iostream.h>
#include<conio.h>
#include<process.h>
#include<fstream.h>
#include<string.h>

class Quiz
{ char userName[30];
int score;
public:
void quizComp();
void dispScore();
// void highScore();
void about();
void legal();
void help();
void start();
void bScience();
void bArts();
void bEnt();
void bGeo();
void bInd();
void bLang();
void bSports();
void iScience();
void iArts();
void iEnt();
void iGeo();
void iInd();
void iLang();
void iSports();
void eScience();
void eArts();
void eEnt();
void eGeo();
void eInd();
void eLang();
void eSports();
};

void main()
{ char choice;
Quiz q1;

clrscr();
cout<<" * * *";
cout<<" * * * ";
cout<<" * ** ";
cout<<" * * * ";
cout<<" * * *";
cout<<"\n\n\n Welcome to INFINITE KNOWLEDGE, the most interactive DOS-based
quiz";
cout<<"\n ever. This will surely sharpen your skills on the topics which you
select.";
cout<<"\n\n So, go ahead and reach your milestone!";
cout<<"\n\n\n\n\n Press 'A' for About, 'L' for Legal, 'H' for Help, 'HS' for
Highest Scores and 'S' to Start:";
cin>>choice;
if ((choice=='A')||(choice=='a'))
{ clrscr();
q1.about();
}
else if((choice=='L')||(choice=='l'))
{ clrscr();
q1.legal();
}
else if((choice=='H')||(choice=='h'))
{ clrscr();
q1.help();
}
else if((choice=='S')||(choice=='s'))
{ clrscr();
q1.start();}
else
{ cout<<"\n Wrong choice...EXITING!!";
exit(0);
}

void Quiz::about()
{ char ch1;

cout<<" * * * * * * * * * * * * * *";
cout<<" * * * * * * * * * ";
cout<<" * * * * * * * * * * * ";
cout<<" * * * * * * * * * ";
cout<<" * * * * * * * * * * * * ";
cout<<"\n\n\n INFINITE KNOWLEDGE is an interactive application quiz based on
the recent";
cout<<"\n affairs, history of world, sciences, computers, english and much
more.";
cout<<"\n Developed to test how much you know of your selection, this'll be a
great help";
cout<<"\n for all in future.";
cout<<"\n See the interrorgation, analyse it and if you're sure then only move
ahead";
cout<<"\n or if you fail for an answer don't worry, we'll provide you. And yes,
there are explanations also!";
cout<<"\n\n\n\n\n Press 'L' for Legal, 'H' for Help, 'HS' for Highest Scores
and 'S' to Start:";
cin>>ch1;
if((ch1=='L')||(ch1=='l'))
{ clrscr();
legal();
}
if((ch1=='H')||(ch1=='h'))
{ clrscr();
help();
}
else if((ch1=='S')||(ch1=='s'))
{ clrscr();
start();
}
else
{ cout<<"n Wrong choice...EXITING!!";
exit(0);
}
system ("pause");
}

void Quiz::legal()
{ char ch2;

cout<<" * * * * * * * * * * * ";
cout<<" * * * * * * ";
cout<<" * * * * * * * * * * ";
cout<<" * * * * * * * ";
cout<<" * * * * * * * * * * * * * * ";
cout<<"\n\n\n Developed by : VAIBHAV KHULBE with ROHAN SHARMA";
cout<<"\n\n Roll No(s) : 12140 and 1213 ";
cout<<"\n\n Class and Section : XII - A";
cout<<"\n\n Last modified on : / / 14";
cout<<"\n\n Questions taken from : 'INFINITE KNOWLEDGE - A Quiz Book' by
VAIBHAV KHULBE and PRATEEK LIDHOO";
cout<<"\n\n (c) 2014 Developers and Authors";
cout<<"\n\n Press 'A' for About, 'H' for Help, 'HS' for Highest Scores and 'S'
to Start:";
cin>>ch2;
if((ch2=='A')||(ch2=='a'))
{ clrscr();
about();
}
else if((ch2=='H')||(ch2=='h'))
{ clrscr();
help();
}
else if((ch2=='S')||(ch2=='s'))
{ clrscr();
start();
}
else if((ch2=='HS')||(ch2=='hs'))
{ clrscr();
// highScore();
}
else
{ cout<<"n Wrong choice...EXITING!!";
exit(0);
}
}

void Quiz::help()
{ char ch3;

clrscr();
cout<<" * * * * * * * * * ";
cout<<" * * * * * * ";
cout<<" * * * * * * * * * ";
cout<<" * * * * * ";
cout<<" * * * * * * * * * ";
cout<<"\n\n\n We believe there isn't any need of HELP for you.";
cout<<"\n This is the most simplest quiz made intuitively for everyone.";
cout<<"\n We'll provide you with extra hints as you give us the answers.";
cout<<"\n For that all you need to do is to choose an option from the four
alternatives : 'a', 'b', 'c' or 'd'!";
cout<<"\n\n\n GO AHEAD!";
cout<<"\n\n\n Press 'A' for About, 'L' for Legal, 'HS' for Highest Scores and
'S' to Start:";
cin>>ch3;
if((ch3=='A')||(ch3=='a'))
{ clrscr();
about();
}
else if((ch3=='S')||(ch3=='s'))
{ clrscr();
start();
}
else if((ch3=='HS')||(ch3=='hs'))
{ clrscr();
// highScore();
}
else if((ch3=='L')||(ch3=='l'))
{ clrscr();
legal();
}
else
{ cout<<"n Wrong choice...EXITING!!";
exit(0);
}
}

void Quiz::start()
{ char lchoice, tchoice;

clrscr();
cout<<"\n How should we call you? :";
cin>>userName;
cout<<"\n"<<userName<<" choose a Level : Beginner \t Intermediate \t Expert";
cout<<"\n Press 'B' for Beginner, 'I' for Intermediate or 'E' for Expert:";
cin>>lchoice;

{ if((lchoice=='B')||(lchoice=='b'))
clrscr();
{ cout<<userName<<" In which of the following topics you're interested
in?";
cout<<"\n 'S'ciences, 'A'rts, 'E'ntertainment, 'G'eography, 'I'ndia,
'L'anguage and Literature or 'S'ports";
cout<<"\n Enter the letter inside the inverted commas of your
selection:";
cin>>tchoice;
if((tchoice=='S')||(tchoice=='s'))
{ clrscr();
bScience();}
if((tchoice=='A')||(tchoice=='a'))
{ clrscr();
bArts();}
if((tchoice=='E')||(tchoice=='e'))
{ clrscr();
bEnt();}
if((tchoice=='G')||(tchoice=='g'))
{ clrscr();
bGeo();}
if((tchoice=='I')||(tchoice=='i'))
{ clrscr();
bInd();}
if((tchoice=='L')||(tchoice=='l'))
{ clrscr();
bLang();}
if((tchoice=='S')||(tchoice=='s'))
{ clrscr();
bSports();}
else
{ cout<<"\n Wrong selection. Enter again:";
cin>>tchoice;}

}
if((lchoice=='I')||(lchoice=='i'))
{ clrscr();
cout<<userName<<" In which of the following topics you're interested in?";
cout<<"\n 'S'ciences, 'A'rts, 'E'ntertainment, 'G'eography, 'I'ndia,
'L'anguage and Literature or 'S'ports";
cout<<"\n Enter the letter inside the inverted commas of your
selection:";
cin>>tchoice;
if((tchoice=='S')||(tchoice=='s'))
{ clrscr();
iScience();}
if((tchoice=='A')||(tchoice=='a'))
{ clrscr();
iArts();}
if((tchoice=='E')||(tchoice=='e'))
{ clrscr();
iEnt();}
if((tchoice=='G')||(tchoice=='g'))
{ clrscr();
iGeo();}
if((tchoice=='I')||(tchoice=='i'))
{ clrscr();
iInd();}
if((tchoice=='L')||(tchoice=='l'))
{ clrscr();
iLang();}
if((tchoice=='S')||(tchoice=='s'))
{ clrscr();
iSports();}
else
{ cout<<"\n Wrong selection. Enter again:";
cin>>tchoice;}

if((tchoice=='E')||(lchoice=='e'))
{
clrscr();
cout<<userName<<" In which of the following topics you're interested in?";
cout<<"\n 'S'ciences, 'A'rts, 'E'ntertainment, 'G'eography, 'I'ndia,
'L'anguage and Literature or 'S'ports";
cout<<"\n Enter the letter inside the inverted commas of your
selection:";
cin>>tchoice;
if((tchoice=='S')||(tchoice=='s'))
{ clrscr();
eScience();}
if((tchoice=='A')||(tchoice=='a'))
{ clrscr();
eArts();}
if((tchoice=='E')||(tchoice=='e'))
{ clrscr();
eEnt();}
if((tchoice=='G')||(tchoice=='g'))
{ clrscr();
eGeo();}
if((tchoice=='I')||(tchoice=='i'))
{ clrscr();
eInd();}
if((tchoice=='L')||(tchoice=='l'))
{ clrscr();
eLang();}
if((tchoice=='S')||(tchoice=='s'))
{ clrscr();
eSports();}
else
{ cout<<"\n Wrong selection. Enter again:";
cin>>tchoice;}
}
}

void Quiz::bScience()
{ clrscr();
char userAns, ch[50];
cout<<"\n\n\n\n You're interested in 'Sciences'";
cout<<"\n and you think you're a 'Beginner'";
cout<<"\n So, let's start...";
for(int i=0;i<10;i++)
{
ifstream f1;
f1.open("bScQues.txt");
while (!f1.eof())
{f1.getline(ch, 50, '\n');
cout<<ch<<endl;}
cout<<"\n\n What's your answer?:";
cin>>userAns;
ifstream f2;
f2.open("bScAns.txt");
while (!f2.eof())
{f2.getline(ch, 50, '\n');
cout<<ch<<endl;}
void quizComp();}
}

void Quiz::bArts()
{ clrscr();
char userAns1, ch1[50];
cout<<"\n\n\n\n You're interested in 'Arts'";
cout<<"\n and you think you're a 'Beginner'";
cout<<"\n So, let's start...";
for(int i=0;i<10;i++)
{
ifstream f3;
f3.open("bArtQues.txt");
while (!f3.eof())
{f3.getline(ch1, 50, '\n');
cout<<ch1<<endl;}
cout<<"\n\n What's your answer?:";
cin>>userAns1;
ifstream f4;
f4.open("bArtAns.txt");
while (!f4.eof())
{f4.getline(ch1, 50, '\n');
cout<<ch1<<endl;}
void quizComp();}
}

You might also like