MCPcopy Create free account
hub / github.com/Rustam-Z/cpp-programming / question4

Function question4

Project_Quiz_Game/quiz-game.cpp:209–249  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

207 }
208}
209void question4() {
210 cout << " ***********************************" << endl;
211 cout << " ***** TOTAL SCORE:" << total_score << " *****" << endl;
212 cout << " ***********************************" << endl;
213 cout << "\t\t\t\t\t Q U E S T I O N No. 4" << endl;
214 cout << "Which of the following is the correct operator to compare two variables?" << endl;
215 cout << "[1] = =" << endl;
216 cout << "[2] :=" << endl;
217 cout << "[3] =" << endl;
218 cout << "[4] ==" << endl;
219 string answer;
220 cout << endl;
221 cout << "\t\t\t\t\tENTER YOUR CHOICE: ";
222 cin >> answer;
223 if (answer == "1" || answer == "2" || answer == "3" || answer == "4")
224 {
225 if (answer == "4") {
226 total_score += 10;
227 correct_answer += 1;
228 cout << "C O R R E C T A N S W E R !!!" << endl;
229 cout << "You got 10 points out of 10." << endl;
230 }
231 else if (answer == "1" || answer == "2" || answer == "3")
232 {
233 cout << "W R O N G A N S W E R !!!" << endl;
234 cout << "You got 0 points out of 10." << endl;
235 }
236 cout << endl;
237 system("pause");
238 system("cls");
239 }
240 else
241 {
242 system("cls");
243 cout << "\t\t*************************************************************************************" << endl;
244 cout << "\t\t**** P L E A S E I N P U T C O R R E C T V A L U E ! ****" << endl;
245 cout << "\t\t*************************************************************************************" << endl;
246 cout << endl;
247 question4();
248 }
249}
250void question5() {
251 cout << " ***********************************" << endl;
252 cout << " ***** TOTAL SCORE:" << total_score << " *****" << endl;

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected