#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<dos.h>
void main()
{
clrscr();
int x;
x = 0;
char ch1[100] , ch2 , ch3 , ch4 , ch5 , ch6 , ch7 , ch8 , ch9 , ch10 , ch11;
cout<<"\n\n\n\n\n\t\t WELCOME !!!\n\n";
cout<<"\n\t\t Please enter your name : ";
gets(ch1);
cout<<"\n\n\t\t LOADING ..... ";
delay(2000);
{ clrscr();
cout<<"\n\n\n\t Hi ";
puts(ch1);
cout<<"\n\n\t Just go through the rules before beginning the QUIZ !";
cout<<"\n\n\t Please wait ....";
delay(2000);
}
{ clrscr();
cout<<"\n\n\n\t\t RULES :- \n\n\t";
delay(2000);
cout<<" 1) The questions are multiple choice questions.\n\n\t";
delay(3000);
cout<<" 2) There is only one correct option to every question.\n\n\t";
delay(3000);
cout<<" 3) Enter answer in the form of 'a' , 'b' , 'c' or 'd' only.\n\n\t";
delay(3000);
cout<<" 4) 10 points will be awarded for every correct answer.\n\n\t";
delay(3000);
cout<<" 5) No points will be deduced for wrong answer.\n\n\t\t\t\t\t";
delay(2000);
cout<<" Enjoy the QUIZ !...";
delay(2000);
{ clrscr();
cout<<"\n\n\n";
cout<<"\t\t Q1: Where is RAM located ?\n\n";
cout<<"\t\t a) Expansion Board\n\n\t\t b) External Drive\n\n\t\t c) Mother Board\n\n\t\t d) All of above\n\n\t\t ";
XX:cin>>ch2;
if(ch2=='c')
{ x = x + 10;
cout<<"\n\n\t\t Absolutely Correct !\n\n\t\t Your score is: "<<x<<"\n\n";
}
else
{ if((ch2=='a')||(ch2=='b')||(ch2=='d'))
cout<<"\n\n\t\t Oops ! Wrong answer.\n\n\t\t The correct answer is c) Mother Board.\n\n";
else
{ cout<<"\n\n\t\t Invalid option !!!\n\n\t\t Please enter a valid option (a,b,c,d).\n\n\t\t ";
goto XX;
}
}
{ clrscr();
cout<<"\n\n\t\t Q2: Java was originally invented by : \n\n";
cout<<"\t\t a) Oracle\n\n\t\t b) Microsoft\n\n\t\t c) Novell\n\n\t\t d) Sun\n\n\t\t ";
YY:cin>>ch3;
if(ch3=='d')
{ x = x + 10;
cout<<"\n\n\t\t Good Job !\n\n\t\t Your score is : "<<x<<"\n\n";
}
else
{ if((ch3=='a')||(ch3=='b')||(ch3=='c'))
cout<<"\n\n\t\t Sorry wrong answer !\n\n\t\t The correct answer is d) Sun.\n\n";
else
{ cout<<"\n\n\t\t Invalid option !!!\n\n\t\t Please enter a valid option (a,b,c,d).\n\n\t\t ";
goto YY;
}
}
{ clrscr();
cout<<"\n\n\t\t Q3: India's first super computer is : \n\n";
cout<<"\t\t a) Agni\n\n\t\t b) Flow solver\n\n\t\t c) Param\n\n\t\t d) Trisul\n\n\t\t ";
ZZ:cin>>ch4;
if(ch4=='c')
{ x = x + 10;
cout<<"\n\n\t\t Awesome !\n\n\t\t Your score is : "<<x<<"\n\n";
}
else
{ if((ch4=='a')||(ch4=='b')||(ch4=='d'))
cout<<"\n\n\t\t Oops ! You are wrong.\n\n\t\t The correct answer is c) Param.\n\n";
else
{ cout<<"\n\n\t\t Invalid option !!!\n\n\t\t Please enter a valid option (a,b,c,d).\n\n\t\t ";
goto ZZ;
}
}
{ clrscr();
cout<<"\n\n\t\t Q4: ROM is composed of : \n\n";
cout<<"\t\t a) Floppy Disk\n\n\t\t b) Magnetic cores\n\n\t\t c) Microprocessors\n\n\t\t d) Photoelectric cells\n\n\t\t ";
AA:cin>>ch5;
if(ch5=='d')
{ x = x + 10;
cout<<"\n\n\t\t Great Job !\n\n\t\t Your score is : "<<x<<"\n\n";
}
else
{ if((ch5=='a')||(ch5=='b')||(ch5=='c'))
cout<<"\n\n\t\t Sorry wrong answer !\n\n\t\t The correct answer is d) Photoelectric cells.\n\n";
else
{ cout<<"\n\n\t\t Invalid option !!!\n\n\t\t Please enter a valid opition (a,b,c,d).\n\n\t\t ";
goto AA;
}
}
{ clrscr();
cout<<"\n\n\t\t Q5: The word length of a computer is measured in : \n\n";
cout<<"\t\t a) Bits\n\n\t\t b) Bytes\n\n\t\t c) Millimetres\n\n\t\t d) Metres\n\n\t\t ";
BB:cin>>ch6;
if(ch6=='b')
{ x = x + 10;
cout<<"\n Well Done !\n Your score is : "<<x<<"\n\n";
}
else
{ if((ch6=='a')||(ch6=='c')||(ch6=='d'))
cout<<"\n\n\t\t Oops ! This is wrong !\n\n\t\t The correct answer is b) Bytes.\n\n";
else
{ cout<<"\n\n\t\t Invalid option !!!\n\n\t\t Please enter a valid option (a,b,c,d).\n\n\t\t ";
goto BB;
}
}
{ clrscr();
cout<<"\n\n\t\t Q6: Compiliers and Interpreters are themselves : \n\n";
cout<<"\t\t a) High Level Language\n\n\t\t b) Codes\n\n\t\t c) Mnemonics\n\n\t\t d) Programs\n\n\t\t ";
CC:cin>>ch7;
if(ch7=='d')
{ x = x + 10;
cout<<"\n\n\t\t Awesome !\n\n\t\t Your score is : "<<x<<"\n\n";
}
else
{ if((ch7=='a')||(ch7=='b')||(ch7=='c'))
cout<<"\n\n\t\t Wrong answer !\n\n\t\t The correct answer is d) Programs\n\n";
else
{ cout<<"\n\n\t\t Invalid option !!!\n\n\t\t Please enter a valid option (a,b,c,d).\n\n\t\t ";
goto CC;
}
}
{ clrscr();
cout<<"\n\n\t\t Q7: Who is considered as The Father of Artificial Intelligence ?\n\n";
cout<<"\t\t a) Alan Turing\n\n\t\t b) John McCarthy\n\n\t\t c) George Boole\n\n\t\t d) Allen Newell\n\n\t\t ";
DD:cin>>ch8;
if(ch8=='b')
{ x = x + 10;
cout<<"\n\n\t\t Great Job !\n\n\t\t Your score is : "<<x<<"\n\n";
}
else
{ if((ch8=='a')||(ch8=='c')||(ch8=='d'))
cout<<"\n\n\t\t Sorry wrong answer !\n\n\t\t The correct answer is b) John McCarthy.\n\n";
else
{ cout<<"\n\n\t\t Invalid option !!!\n\n\t\t Please enter a valid option (a,b,c,d).\n\n\t\t ";
goto DD;
}
}
{ clrscr();
cout<<"\n\n\t\t Q8: CD ROM is a/an : \n\n";
cout<<"\t\t a) Optical device\n\n\t\t b) Magnetic device\n\n\t\t c) Electro Magnetic device\n\n\t\t d) Mechanical device\n\n\t\t ";
EE:cin>>ch9;
if(ch9=='c')
{ x = x + 10;
cout<<"\n\n\t\t Brilliant !\n\n\t\t Your score is : "<<x<<"\n\n";
}
else
{ if((ch9=='a')||(ch9=='b')||(ch9=='d'))
cout<<"\n\n\t\t Oops ! You are wrong !\n\n\t\t The correct answer is c) Electro Magnetic device.\n\n";
else
{ cout<<"\n\n\t\t Invalid option !!!\n\n\t\t Please enter a valid option (a,b,c,d).\n\n\t\t ";
goto EE;
}
}
{ clrscr();
cout<<"\n\n\t\t Q9: Who is the founder of Bing ?\n\n";
cout<<"\t\t a) Steve Ballmer\n\n\t\t b) David Filo\n\n\t\t c) Jeny Yang\n\n\t\t d) None of the above\n\n\t\t ";
FF:cin>>ch10;
if(ch10=='a')
{ x = x + 10;
cout<<"\n\n\t\t Absolutely correct !\n\n\t\t Your score is : "<<x<<"\n\n";
}
else
{ if((ch10=='b')||(ch10=='c')||(ch10=='d'))
cout<<"\n\n\t\t Wrong answer !\n\n\t\t The correct answer is a) Steve Ballmer.\n\n";
else
{ cout<<"\n\n\t\t Invalid option !!!\n\n\t\t Please enter a valid option (a,b,c,d).\n\n\t\t ";
goto FF;
}
}
{ clrscr();
cout<<"\n\n\t\t Q10: Who are the founders of Google ?\n\n";
cout<<"\t\t a) Larry Page & Sergey Brin\n\n\t\t b) Jawed Karim & Chad Hurley\n\n\t\t c) Steve Chen & Chad Hurley\n\n\t\t d) Jerry Yang & Steve Ballmer\n\n\t\t ";
GG:cin>>ch11;
if(ch11=='a')
{ x = x + 10;
cout<<"\n\n\t\t Brilliant Job !\n\n\t\t Your score is : "<<x<<"\n\n";
}
else
{ if((ch11=='b')||(ch11=='c')||(ch11=='d'))
cout<<"\n\n\t\t Sorry wrong answer !\n\n\t\t The correct answer is a) Larry Page & Sergey Brin.\n\n";
else
{ cout<<"\n\n\t\t Invalid opiton !!!\n\n\t\t Please enter a valid option (a,b,c,d).\n\n\t\t ";
goto GG;
}
}
{ clrscr();
cout<<"\n\n\n\t\t Well Done ! ";
cout<<"\n\n\t\t Here's the result ";
cout<<"\n\n\n\t\t\t\t LOADING";
delay(1000);
cout<<".";
delay(1000);
cout<<".";
delay(1000);
cout<<".";
delay(1000);
cout<<".";
delay(2000);
if((x==100)||(x==90)||(x==80))
{ cout<<"\n\n\t\t AWESOME !!!\n\t\t You are Extremely BRILLIANT !!!\n\t\t Keep it up !\n\t\t Your total score is : "<<x;
}
else
{ if((x==70)||(x==60)||(x==50))
cout<<"\n\n\t\t Good Job !\n\t\t You can perform more better.\n\t\t Your score is : "<<x;
else
{ if((x==40)||(x==30))
cout<<"\n\n\t\t You are Average !\n\t\t Better luck next time !\n\t\t Your total score is : "<<x;
else
cout<<"\n\n\t\t Not a Good performance !!!\n\t\t Your total score is : "<<x;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
What I have tried:
The portion given below of all the questions is not showing any output !
if(ch5=='d')
{ x = x + 10;
cout<<"\n\n\t\t Great Job !\n\n\t\t Your score is : "<<x<<"\n\n";
}
else
{ if((ch5=='a')||(ch5=='b')||(ch5=='c'))
cout<<"\n\n\t\t Sorry wrong answer !\n\n\t\t The correct answer is d) Photoelectric cells.\n\n";
else
{ cout<<"\n\n\t\t Invalid option !!!\n\n\t\t Please enter a valid opition (a,b,c,d).\n\n\t\t ";
goto AA;
}
}