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

Function question1

Project_Quiz_Game/quiz-game.cpp:82–124  ·  view source on GitHub ↗

questions

Source from the content-addressed store, hash-verified

80}
81//questions
82void question1() {
83 cout << " ***********************************" << endl;
84 cout << " ***** TOTAL SCORE:" << total_score << " *****" << endl;
85 cout << " ***********************************" << endl;
86 cout << "\t\t\t\t\t Q U E S T I O N No. 1"<< endl;
87 cout << "What is the correct value to return to the operating system upon the successful completion of a program?" << endl;
88 cout << "[1] -1"<<endl;
89 cout << "[2] 1" << endl;
90 cout << "[3] 0" << endl;
91 cout << "[4] Programs do not return a value" << endl;
92 string answer;
93 cout << endl;
94 cout << "\t\t\t\t\tENTER YOUR CHOICE: ";
95 cin >> answer;
96 //limiting the answers of the user
97 if (answer == "1" || answer == "2" || answer == "3" || answer == "4")
98 {
99 if (answer == "3")
100 {
101 total_score += 10;
102 correct_answer += 1;
103 cout << "C O R R E C T A N S W E R !!!" << endl;
104 cout << "You got 10 points out of 10." << endl;
105 }
106 else if (answer == "1" || answer == "2" || answer == "4")
107 {
108 cout << "W R O N G A N S W E R !!!" << endl;
109 cout << "You got 0 points out of 10." << endl;
110 }
111 cout << endl;
112 system("pause");
113 system("cls");
114 }
115 else
116 {
117 system("cls");
118 cout << "\t\t*************************************************************************************" << endl;
119 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;
120 cout << "\t\t*************************************************************************************" << endl;
121 cout << endl;
122 question1();
123 }
124}
125void question2() {
126 cout << " ***********************************" << endl;
127 cout << " ***** TOTAL SCORE:" << total_score << " *****" << endl;

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected