C++ program For making a interactive Quiz with Score.
C++ program For making a interactive Quiz with Score.
- dinesh Kumar E
This is a very easy C++ code which i made for my school project.
Hope you can get some idea for your Project from this.
Code:
#include<iostream>
#include <unistd.h>
#include<iomanip>
#include<windows.h>
using namespace std;
int s,score=0;
string a[20],i;
int main()
{
for(s=0;s<92;s++)cout<<"*";
cout<<"\n* English Quiz *"<<endl;
for(s=0;s<92;s++)cout<<"*";
cout<<endl<<endl;
cout<<setw(60)<<"-Two Gentle men of Verona-"<<endl<<endl;
cout<cout<<"Instructions:\n+ There will be 20 questions in this game.\n+ Each questios carry 10 points.\n+ For every wrong answer -5 will be provided.\n\n"<<setw(52)<<"!.ALL THE BEST.!"<<endl;
cout<<endl<<endl;
cin>>i;
sleep(2);
cout<<setw(52)<<"Round 1-Synonyms"<<endl<<endl;
cout<<"1. Meaning of Shrugged"<<endl<<endl;
cout<<"a.bent\nb.shook\nc.drooped\nd.raised"<<endl<<endl;
cout<<"Enter your option : ";
cin>>a[0];
if(a[0]=="d"||a[0]=="D")
{
score=score+10;
cout<<"Correct answer.. :-)\nNext Question in..";
for(s=3;s>0;s--)
{
cout<<s<<"... ";
sleep(1);
}
cout<<endl<<"==============================";
cout<<endl<<endl;
}
else
{
score=score-5;
cout<<"Wrong answer.. :-(\nNext Question in..";
for(s=3;s>0;s--)
{
cout<<s<<"... ";
sleep(1);
}
cout<<"correct answer is : option (d) Raised "<<endl;
cout<<endl<<"==============================";
cout<<endl<<endl;
}
cout<<"2. Meaning of artless"<<endl<<endl;
cout<<"a.ugly\nb.beautiful\nc.innocent\nd.proper"<<endl<<endl;
cout<<"Enter your option : ";
cin>>a[1];
if(a[1]=="c"||a[1]=="C")
{
score=score+10;
cout<<"Correct answer.. :-)\nNext Question in..";
for(s=4;s>0;s--)
{
cout<<s<<"... ";
sleep(1);
}
cout<<endl<<"==============================";
cout<<endl<<endl;
}
else
{
score=score-5;
cout<<"Wrong answer.. :-(\nNext Question in..";
for(s=3;s>0;s--)
{
cout<<s<<"... ";
sleep(1);
}
cout<<"correct answer is : option (c) innocent "<<endl;
cout<<endl<<"==============================";
cout<<endl<<endl;
}
cout<<"3. Meaning of deserted"<<endl<<endl;
cout<<"a.Empty\nb.Inhabited\nc.Sandy\nd.Crowded"<<endl<<endl;
cout<<"Enter your option : ";
cin>>a[2];
if(a[2]=="a"||a[2]=="A")
{
score=score+10;
cout<<"Correct answer.. :-)\nNext Question in..";
for(s=3;s>0;s--)
{
cout<<s<<"... ";
sleep(1);
}
cout<<endl<<"==============================";
cout<<endl<<endl;
}
else
{
score=score-5;
cout<<"Wrong answer.. :-(\nNext Question in..";
for(s=3;s>0;s--)
{
cout<<s<<"... ";
sleep(1);
}
cout<<"correct answer is : option (d) Empty "<<endl;
cout<<endl<<"==============================";
cout<<endl<<endl;
}
cout<<"4. Meaning of barely"<<endl<<endl;
cout<<"a.Surely\nb.Happily\nc.Hardly\nd.sadly"<<endl<<endl;
cout<<"Enter your option : ";
cin>>a[3];
if(a[3]=="c"||a[3]=="C ")
{
score=score+10;
cout<<"Correct answer.. :-)\nNext Question in..";
for(s=3;s>0;s--)
{
cout<<s<<"... ";
sleep(1);
}
cout<<endl<<"==============================";
cout<<endl<<endl;
}
else
{
score=score-5;
cout<<"Wrong answer.. :-(\nNext Question in..";
for(s=3;s>0;s--)
{
cout<<s<<"... ";
sleep(1);
}
cout<<"correct answer is : option (c) hardly "<<endl;
cout<<endl<<"==============================";
cout<<endl<<endl;
}
cout<<setw(52)<<"Round 2-Antonyms"<<endl<<endl;
cout<<"5. Opposite of Shabby"<<endl<<endl;
cout<<"a.Dirty\nb.Neat\nc.Tatered\nd.Ragged"<<endl<<endl;
cout<<"Enter your option : ";
cin>>a[4];
if(a[4]=="b"||a[4]=="B")
{
score=score+10;
cout<<"Correct answer.. :-)\nNext Question in..";
for(s=3;s>0;s--)
{
cout<<s<<"... ";
sleep(1);
}
cout<<endl<<"==============================";
cout<<endl<<endl;
}
else
{
score=score-5;
cout<<"Wrong answer.. :-(\nNext Question in..";
for(s=3;s>0;s--)
{
cout<<s<<"... ";
sleep(1);
}
cout<<"correct answer is : option (b) neat "<<endl;
cout<<endl<<"==============================";
cout<<endl<<endl;
}
cout<<"6. Opposite of Brisk"<<endl<<endl;
cout<<"a.Slow\nb.Quick\nc.poor\nd.Difficult"<<endl<<endl;
cout<<"Enter your option : ";
cin>>a[5];
if(a[5]=="a"||a[5]=="A")
{
score=score+10;
cout<<"Correct answer.. :-)\nNext Question in..";
for(s=3;s>0;s--)
{
cout<<s<<"... ";
sleep(1);
}cout<<"correct answer is : option (a) slow "<<endl;
cout<<endl<<"==============================";
cout<<endl<<endl;
}
else
{
score=score-5;
cout<<"Wrong answer.. :-(\nNext Question in..";
for(s=3;s>0;s--)
{
cout<<s<<"... ";
sleep(1);
}
cout<<"correct answer is : option (a) slow "<<endl;
cout<<endl<<"==============================";
cout<<endl<<endl;
}
cout<<"7. Opposite of Frequently"<<endl<<endl;
cout<<"a.Often\nb.Regularly\nc.Seldom\nd.Happily"<<endl<<endl;
cout<<"Enter your option : ";
cin>>a[6];
if(a[6]=="c"||a[6]=="C")
{
score=score+10;
cout<<"Correct answer.. :-)\nNext Question in..";
for(s=3;s>0;s--)
{
cout<<s<<"... ";
sleep(1);
}
cout<<endl<<"==============================";
cout<<endl<<endl;
}
else
{
score=score-5;
cout<<"Wrong answer.. :-(\nNext Question in..";
for(s=3;s>0;s--)
{
cout<<s<<"... ";
sleep(1);
}
cout<<"correct answer is : option (c) seldom "<<endl;
cout<<endl<<"==============================";
cout<<endl<<endl;
}
cout<<"8. Opposite of Pleasant"<<endl<<endl;
cout<<"a.Good\nb.Ugly\nc.Beautiful\nd.Sad"<<endl<<endl;
cout<<"Enter your option : ";
cin>>a[7];
if(a[7]=="b"||a[7]=="B")
{
score=score+10;
cout<<"Correct answer.. :-)\nNext Question in..";
for(s=3;s>0;s--)
{
cout<<s<<"... ";
sleep(1);
}
cout<<endl<<"==============================";
cout<<endl<<endl;
}
else
{
score=score-5;
cout<<"Wrong answer.. :-(\nNext Question in..";
for(s=3;s>0;s--)
{
cout<<s<<"... ";
sleep(1);
}
cout<<"correct answer is : option (b) ugly "<<endl;
cout<<endl<<"==============================";
cout<<endl<<endl;
}
cout<<setw(52)<<"Round 3-Homophones and Confusable"<<endl<<endl;
cout<<"9. 'He wants to_______ to Australia'"<<endl<<endl;
cout<<"a.Emigrate\nb.Immigrate"<<endl<<endl;
cout<<"Enter your option : ";
cin>>a[8];
if(a[8]=="b"||a[8]=="B")
{
score=score+10;
cout<<"Correct answer.. :-)\nNext Question in..";
for(s=3;s>0;s--)
{
cout<<s<<"... ";
sleep(1);
}
cout<<endl<<"==============================";
cout<<endl<<endl;
}
else
{
score=score-5;
cout<<"Wrong answer.. :-(\nNext Question in..";
for(s=3;s>0;s--)
{
cout<<s<<"... ";
sleep(1);
}
cout<<"correct answer is : option (b) immigrate "<<endl;
cout<<endl<<"==============================";
cout<<endl<<endl;
}
cout<<"10. 'Education should be the _______ mixture of Skill and knowledge'"<<endl<<endl;
cout<<"a.Judicious\nb.Judicial"<<endl<<endl;
cout<<"Enter your option : ";
cin>>a[9];
if(a[9]=="a"||a[9]=="A")
{
score=score+10;
cout<<"Correct answer.. :-)\nNext Question in..";
for(s=4;s>0;s--)
{
cout<<s<<"... ";
sleep(1);
}
cout<<endl<<"==============================";
cout<<endl<<endl;
}
else
{
score=score-5;
cout<<"Wrong answer.. :-(\nNext Question in..";
for(s=3;s>0;s--)
{
cout<<s<<"... ";
sleep(1);
}
cout<<"correct answer is : option (a) judicious "<<endl;
cout<<endl<<"==============================";
cout<<endl<<endl;
}
cout<<"11. 'The teacher _______ the answer from the student'"<<endl<<endl;
cout<<"a.illicit\nb.Elicited"<<endl<<endl;
cout<<"Enter your option : ";
cin>>a[10];
if(a[10]=="b"||a[10]=="B")
{
score=score+10;
cout<<"Correct answer.. :-)\nNext Question in..";
for(s=3;s>0;s--)
{
cout<<s<<"... ";
sleep(1);
}
cout<<endl<<"==============================";
cout<<endl<<endl;
}
else
{
score=score-5;
cout<<"Wrong answer.. :-(\nNext Question in..";
for(s=3;s>0;s--)
{
cout<<s<<"... ";
sleep(1);
}
cout<<"correct answer is : option (b) elicited "<<endl;
cout<<endl<<"==============================";
cout<<endl<<endl;
}
cout<<"12. '______ medicine is prescribed for yhe child'"<<endl<<endl;
cout<<"a.Aural\nb.Oral\nc.None of these"<<endl<<endl;
cout<<"Enter your option : ";
cin>>a[11];
if(a[11]=="B"||a[11]=="b")
{
score=score+10;
cout<<"Correct answer.. :-)\nNext Question in..";
for(s=3;s>0;s--)
{
cout<<s<<"... ";
sleep(1);
}
cout<<endl<<"==============================";
cout<<endl<<endl;
}
else
{
score=score-5;
cout<<"Wrong answer.. :-(\nNext Question in..";
for(s=3;s>0;s--)
{
cout<<s<<"... ";
sleep(1);
}
cout<<"correct answer is : option (b) oral "<<endl;
cout<<endl<<"==============================";
cout<<endl<<endl;
}
cout<<setw(52)<<"Round 4-Glance at Prose"<<endl<<endl;
cout<<"13. who said these lines 'I thought you picked fruit for a living'"<<endl<<endl;
cout<<"a.Nichola\nb.Jacopo\nc.Driver\nd.Cronin"<<endl<<endl;
cout<<"Enter your option : ";
cin>>a[12];
if(a[12]=="d"||a[12]=="D")
{
score=score+10;
cout<<"Correct answer.. :-)\nNext Question in..";
for(s=3;s>0;s--)
{
cout<<s<<"... ";
sleep(1);
}
cout<<endl<<"==============================";
cout<<endl<<endl;
}
else
{
score=score-5;
cout<<"Wrong answer.. :-(\nNext Question in..";
for(s=3;s>0;s--)
{
cout<<s<<"... ";
sleep(1);
}
cout<<"correct answer is : option (d) cronin "<<endl;
cout<<endl<<"==============================";
cout<<endl<<endl;
}
cout<<"14.Lucia was suffering from ?"<<endl<<endl;
cout<<"a.Tuberculosis\nb.Brain injury\nc.Paralysis\nd.Visual impairment"<<endl<<endl;
cout<<"Enter your option : ";
cin>>a[13];
if(a[13]=="a"||a[13]=="A")
{
score=score+10;
cout<<"Correct answer.. :-)\nNext Question in..";
for(s=4;s>0;s--)
{
cout<<s<<"... ";
sleep(1);
}
cout<<endl<<"==============================";
cout<<endl<<endl;
}
else
{
score=score-5;
cout<<"Wrong answer.. :-(\nNext Question in..";
for(s=3;s>0;s--)
{
cout<<s<<"... ";
sleep(1);
}
cout<<"correct answer is : option (a) tuberclosis "<<endl;
cout<<endl<<"==============================";
cout<<endl<<endl;
}
cout<<"15. 'What the author bought from the two boys ?"<<endl<<endl;
cout<<"a.pack of apples\nb.newspapers\nc.basket of oranges\nd.basket of strawberries"<<endl<<endl;
cout<<"Enter your option : ";
cin>>a[14];
if(a[14]=="d"||a[14]=="D")
{
score=score+10;
cout<<"Correct answer.. :-)\nNext Question in..";
for(s=3;s>0;s--)
{
cout<<s<<"... ";
sleep(1);
}
cout<<endl<<"==============================";
cout<<endl<<endl;
}
else
{
score=score-5;
cout<<"Wrong answer.. :-(\nNext Question in..";
for(s=3;s>0;s--)
{
cout<<s<<"... ";
sleep(1);
}
cout<<"correct answer is : option (d) basket of strawberry "<<endl;
cout<<endl<<"==============================";
cout<<endl<<endl;
}
cout<<"16. What made the boys work so hard..?"<<endl<<endl;
cout<<"a.They have a plan to emigrate to America\nb.nThey wish to cure their sister from tuberculosis\nc.For food\nd. To buy a house"<<endl<<endl;
cout<<"Enter your option : ";
cin>>a[15];
if(a[15]=="B"||a[15]=="b")
{
score=score+10;
cout<<"Correct answer.. :-)\nNext Question in..";
for(s=3;s>0;s--)
{
cout<<s<<"... ";
sleep(1);
}
cout<<endl<<"==============================";
cout<<endl<<endl;
}
else
{
score=score-5;
cout<<"Wrong answer.. :-(\nNext Question in..";
for(s=3;s>0;s--)
{
cout<<s<<"... ";
sleep(1);
}
cout<<"correct answer is: option (b) They wish to cure their sister from tuberculosis"<<endl;
cout<<endl<<"==============================";
cout<<endl<<endl;
}
cout<<"17. Fill in with Correct Words \n'All that _____ about it is that hundreds of people _______ in it'"<<endl<<endl;
cout<<"a.I know & had died\nb.I've known & had died\nc.I know & died\nd.I've known & died "<<endl<<endl;
cout<<"Enter your option : ";
cin>>a[16];
if(a[16]=="d"||a[16]=="D")
{
score=score+10;
cout<<"Correct answer.. :-)\nNext Question in..";
for(s=3;s>0;s--)
{
cout<<s<<"... ";
sleep(1);
}
cout<<endl<<"==============================";
cout<<endl<<endl;
}
else
{
score=score-5;
cout<<"Wrong answer.. :-(\nNext Question in..";
for(s=3;s>0;s--)
{
cout<<s<<"... ";
sleep(1);
}
cout<<"correct answer is : option (d) I've known & died"<<endl;
cout<<endl<<"==============================";
cout<<endl<<endl;
}
cout<<"18.The Citadel and The Keys of the Kingdom were made into successful _______"<<endl<<endl;
cout<<"a.Films\nb.Novels\nc.Short movie\nd.Web Series"<<endl<<endl;
cout<<"Enter your option : ";
cin>>a[17];
if(a[17]=="a"||a[17]=="A")
{
score=score+10;
cout<<"Correct answer.. :-)\nNext Question in..";
for(s=4;s>0;s--)
{
cout<<s<<"... ";
sleep(1);
}
cout<<endl<<"==============================";
cout<<endl<<endl;
}
else
{
score=score-5;
cout<<"Wrong answer.. :-(\nNext Question in..";
for(s=3;s>0;s--)
{
cout<<s<<"... ";
sleep(1);
}
cout<<"correct answer is : option (a) films"<<endl;
cout<<endl<<"==============================";
cout<<endl<<endl;
}
cout<<"19. Joseph Cronin was a author from ______"<<endl<<endl;
cout<<"a.Ireland\nb.Finland\nc.Scotland\nd.Germany"<<endl<<endl;
cout<<"Enter your option : ";
cin>>a[18];
if(a[18]=="c"||a[18]=="C")
{
score=score+10;
cout<<"Correct answer.. :-)\nNext Question in..";
for(s=3;s>0;s--)
{
cout<<s<<"... ";
sleep(1);
}
cout<<endl<<"==============================";
cout<<endl<<endl;
}
else
{
score=score-5;
cout<<"Wrong answer.. :-(\nNext Question in..";
for(s=3;s>0;s--)
{
cout<<s<<"... ";
sleep(1);
}
cout<<"correct answer is : option (C) Scotland"<<endl;
cout<<endl<<"==============================";
cout<<endl<<endl;
}
cout<<"20. Where did the narrator driving through foothills of...?"<<endl<<endl;
cout<<"a.Verona\nb.Alps\nc.mount Fuji\nd. Kilimanjaro"<<endl<<endl;
cout<<"Enter your option : ";
cin>>a[19];
if(a[19]=="B"||a[15]=="b")
{
score=score+10;
cout<<"Correct answer.. :-)\nNext Question in..";
for(s=3;s>0;s--)
{
cout<<s<<"... ";
sleep(1);
}
cout<<endl<<"==============================";
cout<<endl<<endl;
}
else
{
score=score-5;
cout<<"Wrong answer...";
cout<<"correct answer is : option(a) alphs"<<endl;
cout<<endl<<"==============================";
cout<<endl<<endl;
}
cout<<"Score is : "<<score;
}
super dinesh !
ReplyDelete