Quiz Game Project in C++
This quiz game is designed to display certain questions onto the screen and the user guesses the correct answer. If the user enters the correct choice, then it will add 10 points to the total score and if a user is unable to guess the correct answer then no negative marking will be performed. The total score at the end of this game is 100.
Scoring Criteria:
If the score is equal to 100 then print: “No cheating…… You have done this earlier also”
If the score is equal to 90, then print: “You are extremely intelligent Your Score is 90”
If the score is equal to 80, then print: “ You are intelligent Your Score is 80”
If the score is equal to 50 or 60 or 70 then print: “You are average Your Score is “<<x<<“Better luck next time”
If the score is less than equal to 40 then print: “use…….. Not even 5 questions right”
Functions of Quiz Game
- void header()
This function is specifically designed to display a stylish header on the top of the game.
- void footer()
This function is specifically designed to display a stylish footer at the bottom of the game.
- void user()
This function is specifically designed to get names from users and displays on the screen.
- void results()
This function is specifically designed to display the results of the game at the end.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
#include<iostream> #include<conio.h> int x=0; using namespace std; class T4Tutorials { public: void header() { cout<<"\t!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*"<<endl; cout<<"\t\t\t\t\t QUIZ GAME "<<endl; cout<<"\t!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*"<<endl; } void footer() { cout<<"\t!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*"<<endl; cout<<"\t\t\t\t\t RESULTS "<<endl; cout<<"\t!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*"<<endl; } void user() { char ch1[100]; cout<<"\t Guest Enter Your Name : "; cin>>ch1; cout<<" \t Welcome "<<ch1<<endl; } void results() { if(x==100) cout<<" \t No cheating...... You have done this earlier also."; if(x==90) cout<<" \t You are extremely intelligent Your Score is 90"; if(x==80) cout<<" \t You are intelligent Your Score is 80"; if(50==x||x==70||x==60) cout<<" \t You are average Your Score is "<<x<<"Better luck next time"; else if(x<=40) cout<<" \t No use........ Not even 5 questions right"; } }; int main() { char ch2,ch3,ch4,ch5,ch6,ch7,ch8,ch9,ch10,ch11; T4Tutorials obj1,obj2,obj3,obj4; obj1.user(); obj2.header(); cout<<"\t Q1. Which of the followins is ' THE HOLY LAND'? \n\t a.Jerusalem \n\t b.Mathura \n\t c.Mecca "<<endl; cin>>ch2; if(ch2=='a') { x=x+10; cout<<" \t Grea! Your Game score is: "<<x<<endl; cout<<" \t Press Enter! "
; } else { cout<<" \t Sorry wrong answer "<<endl; cout<<" \t Press Enter! "; } getch(); system ("CLS"); obj2.header(); cout<<"\t Q2. Which of the followins is called as ' THE ROOF OF THE WORLD'? \n\t a.Nepal \n\t b.Rome \n\t c.Tibet "<<endl; cin>>ch2; if(ch2=='c') { x=x+10; cout<<" \t Grea! Your Game score is: "<<x; } else { cout<<" \t Sorry wrong answer "<<endl; cout<<" \t Press Enter! "; } getch(); system ("CLS"); obj2.header(); cout<<"\t Q3. Which of the followins is called as ' THE LAND OF RISING SUN'? \n\t a.Chicago \n\t b.Japan \n\t c.Tibet"<<endl; cin>>ch2; if(ch2=='b') { x=x+10; cout<<" \t Grea! Your Game score is: "<<x; } else { cout<<" \t Sorry wrong answer "<<endl; cout<<" \t Press Enter! "; } getch(); system ("CLS"); obj2.header(); cout<<"\t Q4. Which of the following is called as ' THE GIFT OF NILE'? \n\t a.Chicago \n\t b.Egypt \n\t c.Africa "<<endl; cin>>ch2; if(ch2=='b') { x=x+10; cout<<" \t Grea! Your Game score is: "<<x; } else { cout<<" \t Sorry wrong answer "<<endl; cout<<" \t Press Enter! "; } getch(); system ("CLS"); obj2.header(); cout<<"\t Q5. Which of the following is called as ' THE LAND OF MIDNIGHT SUN'? \n\t a.Norway \n\t b.Japan \n\t c.Australia"<<endl; cin>>ch2; if(ch2=='a') { x=x+10; cout<<" \t Grea! Your Game score is: "<<x; } else { cout<<" \t Sorry wrong answer "<<endl; cout<<" \t Press Enter! "
; } getch(); system ("CLS"); obj2.header(); cout<<"\t Q6. Which of the following is called as ' THE LAND OF THUNDERBOLT'? \n\t a.Bhutan \n\t b.Canada \n\t c.Arab"<<endl; cin>>ch2; if(ch2=='a') { x=x+10; cout<<" \t Grea! Your Game score is: "<<x; } else { cout<<" \t Sorry wrong answer "<<endl; cout<<" \t Press Enter! "; } getch(); system ("CLS"); obj2.header(); cout<<" \t Q7. Which of the following is called as ' THE WINDY CITY? \n\t a.Jerusalem \n\t b.Japan \n\t c.Chicago"<<endl; cin>>ch2; if(ch2=='c') { x=x+10; cout<<" \t Grea! Your Game score is: "<<x; } else { cout<<" \t Sorry wrong answer "<<endl; cout<<" \t Press Enter! "; } getch(); system ("CLS"); obj2.header(); cout<<"\t Q8. Which of the following is called as ' THE LAND OF WHITE ELEPHANTS'? \n\t a.Bangladesh \n\t b.Thailand \n\t c.India"<<endl; cin>>ch2; if(ch2=='b') { x=x+10; cout<<" \t Grea! Your Game score is: "<<x; } else { cout<<" \t Sorry wrong answer "<<endl; cout<<" \t Press Enter! "; } getch(); system ("CLS"); obj2.header(); cout<<"\t Q9. Which of the following is called as ' THE CITY OF SEVEN HILLS'? \n\t a.Rome \n\t b.Nilgiri Hills \n\t c.Tibet "<<endl; cin>>ch2; if(ch2=='a') { x=x+10; cout<<" \t Grea! Your Game score is: "<<x; } else { cout<<" \t Sorry wrong answer "<<endl; cout<<" \t Press Enter! "; } getch(); system ("CLS"); obj2.header(); cout<<"\t Q10. Which of the following is called as ' THE DARK CONTIENENT'? \n\t a.Asia \n\t b.Australia \n\t c.Africa"<<endl; cin>>ch2; if(ch2=='c') { x=x+10; cout<<" \t Grea! Your Game score is: "<<x; } else { cout<<" \t Sorry wrong answer "<<endl; cout<<" \t Press Enter! "; } getch(); system ("CLS"); obj3.footer(); obj4.results(); getch(); return 0; } |