program about are you smarter than a 5th grader

Pages: 12
cout<<"This game will ask questions to you with general knowledge questions. The more questions you answers correctly, the longer you stay in the game. The questions asked to you increase in difficulty, starting with first-grade level and progressing in difficulty up to questions from a fifth-grade curriculum. The player earns a PHP 1,000 for each question he answers correctly. Just one wrong answer and you will be eliminated from the game. Don't worry, you have three lifelines that can save you, these are the peek,copy, and save.\n\n Peek - this lifeline will allow you to see the answer, but it will still depend on you if you will copy it or not\n\n Copy - this lifeline will automatically copy the right answer\n\n Save - this lifeline will automatically save you even if you write the wrong answer";

Hi,

Do you know that one can build up std::cout output over several lines of code? It doesn't have to be one giant line. As it stands it is 4 screens wide when displayed here, and I have a wide screen monitor. Try this, as an example:

1
2
3
std::cout << "This game will ask questions to you with general knowledge questions. The more "
              << "questions you answers correctly, the longer you stay in the game. The questions asked to you"
              << "  increase in difficulty, starting with first-grade level and progressing in difficulty ";
Last edited on
I cant come up with any clever solutions, you could brake it down like the help option
have 10 couts rapped up in an if statements

or have an array that would store number of questions that were already selected and then if the player select any of those you could output message like: number this or that can not be selected again, select different category
and then loop back to ask user to select category




i already done the array and it works ! :D

but the problem is there's still so many errors in validations, and my professor wants a perfect machine problem, tomorrow is the submission, can i ask you if you have a copy of your machine problem ? a not so basic machine problem but not too complex, thank you :(
there is no way I or anyone else will just hand you their code to copy. If you have a specific problem show us the code portion of a code) and what you already tried to do, and if someone knows how to help you, they will.
ohh i see hehe

i cannot post my machine problem here because it is too long,and also i can't post the part where the problem starts since i can't point out where it is , so im gonna send my code here part by part? is that okay? :D
//this is my program part by part it already works but how can i put congratulations at the end after the user answer correctly my program, thanks :D



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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
#include<iostream>
#include<conio.h>
#include<string>
using namespace std;
int main()
{
string A,animal,correct,heading,A1,answer1,name;
int age,subject;
string subj[10] = {"[1] Grade 1 Civics and culture" ,  "[2] Grade 1 Filipino", "[3] Grade 2 English","[4] Grade 2 Math", "[5] Grade 3 Civics and Culture", "[6] Grade 3 Math", "[7] Grade 4 History", "[8] Grade 4 MAPEH" , "[9] Grade 5 Science", "[10] Grade 5 English"};
char play,another,N,n,Y,y,ans,g,G,I,i,X,x,C1,help;
bool peekUsed=false;
bool copyUsed=false;
bool saveUsed=false;

cout << "Welcome to our Game show"<< endl;
cout << "====================================================" << endl;                   
cout << "Are you smarter than a 5th grader?" << endl; 
cout << "====================================================\n\n" << endl; 

cout<<"Enter name (first name only): ";
cin>>name;
cout<<"Enter age: ";
cin>>age;
system("cls");
cout << "====================================================" << endl;                   
cout << "Are you smarter than a 5th grader?" << endl; 
cout << "====================================================\n\n\n" << endl; 
cout << "  (I recommend you to read instructions first to avoid confusion in the game) \n\n";
cout<<"Press [I] for instructions, [G] for start, [X] for exit: ";
cin>>ans;
if(ans=='G'||ans=='g'){
	while(A1==correct){
system("cls");
cout << "====================================================" << endl;                   
cout << "Are you smarter than a 5th grader?" << endl; 
cout << "====================================================\n\n\n" << endl; 

//cout<<" [1] Grade 1 Civics and Culture [2] Grade 1 Filipino\n\n [3] Grade 2 English\t\t [4] Grade 2 Math\n\n [5] Grade 3 Civics and Culture [6] Grade 3 Math\n\n [7] Grade 4 History\t\t [8] Grade 4 MAPEH\n\n [9] Grade 5 Science\t\t [10] Grade 5 English\n\n";
for(int ctr = 0;  ctr<10; ctr++)
{
	cout<<subj[ctr]<<endl;
}
cout<<"\nPlease select your subject: ";
cin>>subject;
system("cls");
switch(subject){
case 1: cout << "====================================================" << endl;                   
cout << "Are you smarter than a 5th grader?" << endl; 
cout << "====================================================\n\n\n" << endl; 
cout<<"Complete the quote below:\n\n"; //answer dito ay: animal
cout<<" He who does not love his own language is worse than an _____ and smelly fish\n\n";
cout<<"Do you need help?[y/n]: ";
cin>>help;
subj[0] = "";
if(help=='Y'||help=='y'){
if (peekUsed == false)
cout << "[P] for peek\n";
if (copyUsed == false)
cout << "[C] for Copy\n";
if(saveUsed == false)
cout<<"[S] for Save\n";
cout<<"Enter your choice: ";
cin>>C1;
{
if(C1=='P'||C1=='p'){
cout<<"\nThe answer is animal";
peekUsed=true;
cout<<"\n\nEnter your answer: ";
cin>>A1;
correct="animal";
{
if(A1==correct)
cout<<"Correct!";

if(A1!=correct)
cout<<"Wrong answer";

}
}
if(C1=='C'||C1=='c'){
cout<<"Correct! The answer is animal ";
copyUsed=true;
}
if(C1=='S'||C1=='s'){
cout<<"Enter your answer: ";
cin>>A;
cout<<"Correct! The answer is animal";
saveUsed=true;
}
}
}
if(help=='N'||help=='n'){
cout<<"Enter your answer: ";
cin>>A1;
correct="animal";
{
if(A1==correct)
cout<<"Correct!";

if(A1!=correct)
cout<<"Wrong answer";

}
}

break;
case 2: cout << "====================================================" << endl;                   
cout << "Are you smarter than a 5th grader?" << endl; 
cout << "====================================================\n\n\n" << endl; 
cout<<"A part of a friendly letter where it states the adress of the writer and the date it was made\n\n"; //answer dito ay heading
cout<<"Do you need help?[y/n]: ";
cin>>help;
subj[1] = "";
if(help=='Y'||help=='y'){
if (peekUsed == false)
cout << "[P] for peek\n";
if (copyUsed == false)
cout << "[C] for Copy\n";
if(saveUsed == false)
cout<<"[S] for Save\n";
cout<<"Enter your choice: ";
cin>>C1;
{
if(C1=='P'||C1=='p'){
cout<<"The answer is heading";
peekUsed=true;
cout<<"\nEnter your answer: ";
cin>>A1;
correct="heading";
{
if(A1==correct)
cout<<"Correct!";

if(A1!=correct)
cout<<"Wrong answer";

}
}
if(C1=='C'||C1=='c'){
cout<<"Correct! The answer is heading ";
copyUsed=true;
}
if(C1=='S'||C1=='s'){
cout<<"Enter your answer: ";
cin>>A;
cout<<"Correct! The answer is heading";
saveUsed=true;
}
}
}
if(help=='N'||help=='n'){
cout<<"Enter your answer: ";
cin>>A1;
correct="heading";
{
if(A1==correct)
cout<<"Correct!";

if(A1!=correct)
cout<<"Wrong answer";

}
}
break;
case 3: cout << "====================================================" << endl;                   
cout << "Are you smarter than a 5th grader?" << endl; 
cout << "====================================================\n\n\n" << endl; 
cout<<"True or False:\n\n"; //answer dito ay true
cout<<"When the plural of a noun shows possession or ownership, it is in its plural possessive form\n\n";
cout<<"Do you need help?[y/n]: ";
cin>>help;
subj[2] = "";
if(help=='Y'||help=='y'){
if (peekUsed == false)
cout << "[P] for peek\n";
if (copyUsed == false)
cout << "[C] for Copy\n";
if(saveUsed == false)
cout<<"[S] for Save\n";
cout<<"Enter your choice: ";
cin>>C1;
{
if(C1=='P'||C1=='p'){
cout<<"The answer is true";
peekUsed=true;
cout<<"\nEnter your answer: ";
cin>>A1;
correct="true";
{
if(A1==correct)
cout<<"Correct!";

if(A1!=correct)
cout<<"Wrong answer";

}
}
if(C1=='C'||C1=='c'){
cout<<"Correct! The answer is true ";
copyUsed=true;
}
if(C1=='S'||C1=='s'){
cout<<"Enter your answer: ";
cin>>A;
cout<<"Correct! The answer is true";
saveUsed=true;
}
}
}
if(help=='N'||help=='n'){
cout<<"Enter your answer: ";
cin>>A1;
correct="true";
{
if(A1==correct)
cout<<"Correct!";

if(A1!=correct)
cout<<"Wrong answer";

}
}
break;
case 4: cout << "====================================================" << endl;                   
cout << "Are you smarter than a 5th grader?" << endl; 
cout << "====================================================\n\n\n" << endl; 
cout<<"Identify:\n\n";
cout<<"A quantity or number to be subtracted from another\n\n"; //answer dito ay subtrahend
cout<<"Do you need help?[y/n]: ";
cin>>help;
subj[3]="";
if(help=='Y'||help=='y'){
if (peekUsed == false)
cout << "[P] for peek\n";
if (copyUsed == false)
cout << "[C] for Copy\n";
if(saveUsed == false)
cout<<"[S] for Save\n";
cout<<"Enter your choice: ";
cin>>C1;
{
if(C1=='P'||C1=='p'){
cout<<"The answer is subtrahend\n";
peekUsed=true;
cout<<"\nEnter your answer: ";
cin>>A1;
correct="subtrahend";
{
if(A1==correct)
cout<<"Correct!";

if(A1!=correct)
cout<<"Wrong answer";

}
}
if(C1=='C'||C1=='c'){
cout<<"Correct! The answer is subtrahend";
copyUsed=true;
}
if(C1=='S'||C1=='s'){
cout<<"Enter your answer: ";
cin>>A;
cout<<"Correct! The answer is subtrahend";
saveUsed=true;
}
}
}
if(help=='N'||help=='n'){
cout<<"Enter your answer: ";
cin>>A1;
correct="subtrahend";
{
if(A1==correct)
cout<<"Correct!";

if(A1!=correct)
cout<<"Wrong answer";

}
}
break;
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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
case 5: cout << "====================================================" << endl;                   
cout << "Are you smarter than a 5th grader?" << endl; 
cout << "====================================================\n\n\n" << endl; 
cout<<"What is the imaginary line that divides the globe into Northern Hemisphere and Southern Hemisphere.\n\n"; //answer dito ay equator
	cout<<"Do you need help?[y/n]: ";
cin>>help;
subj[4]="";
if(help=='Y'||help=='y'){
if (peekUsed == false)
cout << "[P] for peek\n";
if (copyUsed == false)
cout << "[C] for Copy\n";
if(saveUsed == false)
cout<<"[S] for Save\n";
cout<<"Enter your choice: ";
cin>>C1;
{
if(C1=='P'||C1=='p'){
cout<<"The answer is equator\n";
peekUsed=true;
cout<<"Enter your answer: ";
cin>>A1;
correct="equator";
{
if(A1==correct)
cout<<"Correct!";

if(A1!=correct)
cout<<"Wrong answer";

}
}
if(C1=='C'||C1=='c'){
cout<<"Correct! The answer is equator";
copyUsed=true;
}
if(C1=='S'||C1=='s'){
cout<<"Enter your answer: ";
cin>>A;
cout<<"Correct! The answer is equator";
saveUsed=true;
}
}
}
if(help=='N'||help=='n'){
cout<<"Enter your answer: ";
cin>>A1;
correct="equator";
{
if(A1==correct)
cout<<"Correct!";

if(A1!=correct)
cout<<"Wrong answer";

}
}
break;
case 6: cout << "====================================================" << endl;                   
cout << "Are you smarter than a 5th grader?" << endl; 
cout << "====================================================\n\n\n" << endl; 
cout<<"Fill in the blanks:\n\n";
cout<<"Fractions representing numbers equal to ____ have the same numerator and denominator\n\n"; //answer dito ay one
	cout<<"Do you need help?[y/n]: ";
cin>>help;
subj[5]="";
if(help=='Y'||help=='y'){
if (peekUsed == false)
cout << "[P] for peek\n";
if (copyUsed == false)
cout << "[C] for Copy\n";
if(saveUsed == false)
cout<<"[S] for Save\n";
cout<<"Enter your choice: ";
cin>>C1;
{
if(C1=='P'||C1=='p'){
cout<<"The answer is one\n";
peekUsed=true;
cout<<"Enter your answer: ";
cin>>A1;
correct="one";
{
if(A1==correct)
cout<<"Correct!";

if(A1!=correct)
cout<<"Wrong answer";

}
}
if(C1=='C'||C1=='c'){
cout<<"Correct! The answer is one";
copyUsed=true;
}
if(C1=='S'||C1=='s'){
cout<<"Enter your answer: ";
cin>>A;
cout<<"Correct! The answer is one";
saveUsed=true;
}
}
}
if(help=='N'||help=='n'){
cout<<"Enter your answer: ";
cin>>A1;
correct="one";
{
if(A1==correct)
cout<<"Correct!";

if(A1!=correct)
cout<<"Wrong answer";

}
}
break;
case 7: cout << "====================================================" << endl;                   
cout << "Are you smarter than a 5th grader?" << endl; 
cout << "====================================================\n\n\n" << endl; 
cout<<"Region 4-A are consists of Quezon,Rizal,Cavite,Laguna,and Batangas. What is the name of these five provinces?\n\n"; //answer dito ay calabarzon
	cout<<"Do you need help?[y/n]: ";
cin>>help;
subj[6]="";
if(help=='Y'||help=='y'){
if (peekUsed == false)
cout << "[P] for peek\n";
if (copyUsed == false)
cout << "[C] for Copy\n";
if(saveUsed == false)
cout<<"[S] for Save\n";
cout<<"Enter your choice: ";
cin>>C1;
{
if(C1=='P'||C1=='p'){
cout<<"The answer is calabarzon\n";
peekUsed=true;
cout<<"Enter your answer: ";
cin>>A1;
correct="calabarzon";
{
if(A1==correct)
cout<<"Correct!";

if(A1!=correct)
cout<<"Wrong answer";

}
}
if(C1=='C'||C1=='c'){
cout<<"Correct! The answer is calabarzon";
copyUsed=true;
}
if(C1=='S'||C1=='s'){
cout<<"Enter your answer: ";
cin>>A;
cout<<"Correct! The answer is calabarzon";
saveUsed=true;
}
}
}
if(help=='N'||help=='n'){
cout<<"Enter your answer: ";
cin>>A1;
correct="calabarzon";
{
if(A1==correct)
cout<<"Correct!";

if(A1!=correct)
cout<<"Wrong answer";

}
}
break;
case 8: cout << "====================================================" << endl;                   
cout << "Are you smarter than a 5th grader?" << endl; 
cout << "====================================================\n\n\n" << endl; 
cout<<"In Music, what is composed of 5 lines and four spaces?\n\n";
	cout<<"Do you need help?[y/n]: ";
cin>>help;
subj[7]="";
if(help=='Y'||help=='y'){
if (peekUsed == false)
cout << "[P] for peek\n";
if (copyUsed == false)
cout << "[C] for Copy\n";
if(saveUsed == false)
cout<<"[S] for Save\n";
cout<<"Enter your choice: ";
cin>>C1;
{
if(C1=='P'||C1=='p'){
cout<<"The answer is staff\n";
peekUsed=true;
cout<<"Enter your answer: ";
cin>>A1;
correct="staff";
{
if(A1==correct)
cout<<"Correct!";

if(A1!=correct)
cout<<"Wrong answer";

}
}
if(C1=='C'||C1=='c'){
cout<<"Correct! The answer is staff";
copyUsed=true;
}
if(C1=='S'||C1=='s'){
cout<<"Enter your answer: ";
cin>>A;
cout<<"Correct! The answer is staff";
saveUsed=true;
}
}
}
if(help=='N'||help=='n'){
cout<<"Enter your answer: ";
cin>>A1;
correct="staff";
{
if(A1==correct)
cout<<"Correct!";

if(A1!=correct)
cout<<"Wrong answer";

}
}
break;
case 9: cout << "====================================================" << endl;                   
cout << "Are you smarter than a 5th grader?" << endl; 
cout << "====================================================\n\n\n" << endl; 
cout<<"Under which sub-group of invertebrate animals do the clam, squid, octopus and snail belong?\n\n"; //answer dito ay mollusks
	cout<<"Do you need help?[y/n]: ";
cin>>help;
subj[8]="";
if(help=='Y'||help=='y'){
if (peekUsed == false)
cout << "[P] for peek\n";
if (copyUsed == false)
cout << "[C] for Copy\n";
if(saveUsed == false)
cout<<"[S] for Save\n";
cout<<"Enter your choice: ";
cin>>C1;
{
if(C1=='P'||C1=='p'){
cout<<"The answer is mollusks\n";
peekUsed=true;
cout<<"Enter your answer: ";
cin>>A1;
correct="mollusks";
{
if(A1==correct)
cout<<"Correct!";

if(A1!=correct)
cout<<"Wrong answer";

}
}
if(C1=='C'||C1=='c'){
cout<<"Correct! The answer is mollusks";
copyUsed=true;
}
if(C1=='S'||C1=='s'){
cout<<"Enter your answer: ";
cin>>A;
cout<<"Correct! The answer is mollusks";
saveUsed=true;
}
}
}
if(help=='N'||help=='n'){
cout<<"Enter your answer: ";
cin>>A1;
correct="mollusks";
{
if(A1==correct)
cout<<"Correct!";

if(A1!=correct)
cout<<"Wrong answer";

}
}
break;
case 10: cout << "====================================================" << endl;                   
cout << "Are you smarter than a 5th grader?" << endl; 
cout << "====================================================\n\n\n" << endl; 
cout<<"Exaggerated statements or claims not meant to be taken literally\n\n"; //answer dito ay hyperbole
	cout<<"Do you need help?[y/n]: ";
cin>>help;
subj[9]="";
if(help=='Y'||help=='y'){
if (peekUsed == false)
cout << "[P] for peek\n";
if (copyUsed == false)
cout << "[C] for Copy\n";
if(saveUsed == false)
cout<<"[S] for Save\n";
cout<<"Enter your choice: ";
cin>>C1;
{
if(C1=='P'||C1=='p'){
cout<<"The answer is hyperbole\n";
peekUsed=true;
cout<<"Enter your answer: ";
cin>>A1;
correct="hyperbole";
{
if(A1==correct)
cout<<"Correct!";

if(A1!=correct)
cout<<"Wrong answer";

}
}
if(C1=='C'||C1=='c'){
cout<<"Correct! The answer is hyperbole";
copyUsed=true;
}
if(C1=='S'||C1=='s'){
cout<<"Enter your answer: ";
cin>>A;
cout<<"Correct! The answer is hyperbole";
saveUsed=true;
}
}
}
if(help=='N'||help=='n'){
cout<<"Enter your answer: ";
cin>>A1;
correct="hyperbole";
{
if(A1==correct)
cout<<"Correct!";

if(A1!=correct)
cout<<"Wrong answer";

}
}

break;
default: 
	cout<<subject<<"Invalid choice";

}
    
}	
}
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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
if(ans=='I'||ans=='i'){
system("cls");
cout << "====================================================" << endl;                   
cout << "Are you smarter than a 5th grader?" << endl; 
cout << "====================================================\n" << endl; 
cout<<"This game will ask questions to you with general knowledge questions. The more questions you answers correctly, the longer you stay in the game. The questions are arranged from grade 1 to grade 5 which you are free to choose to answer first what do you think easy for you. The program is case sensitive, so you should always type your answers in small letters like *dog*,*cat*, etc. If there are answers like *1* , you should type it in letters ex. *one* . Just one wrong answer and you will be eliminated from the game, so please be careful in typing your answers. Don't worry, you have three lifelines that can save you, these are the peek,copy, and save.\n\nPeek - this lifeline will allow you to see the answer, but it will still depend on you if you will copy it or not\n\nCopy - this lifeline will automatically copy the right answer and get you to the main menu again.\n\nSave - this lifeline will automatically save you even if you write the wrong answer and get you back to the main menu.";
cout<<"\n\n\nDo you want now to play the game?[y/n]: ";
cin>>play;
}
{
if(play=='Y'||play=='y'){
	while(A1==correct){
system("cls");
cout << "====================================================" << endl;                   
cout << "Are you smarter than a 5th grader?" << endl; 
cout << "====================================================\n\n\n" << endl; 
//cout<<" [1]  Grade 1 Civics and Culture [2] Grade 1 Filipino\n\n [3] Grade 2 English\t\t [4] Grade 2 Math\n\n [5] Grade 3 Civics and Culture [6] Grade 3 Math\n\n [7] Grade 4 History\t\t [8] Grade 4 MAPEH\n\n [9] Grade 5 Science\t\t [10] Grade 5 English\n\n";
for(int ctr = 0;  ctr<10; ctr++)
{
	cout<<subj[ctr]<<endl;
}
cout<<"\nPlease select your subject: ";
cin>>subject;
system("cls");
switch(subject){
case 1: cout << "====================================================" << endl;                   
cout << "Are you smarter than a 5th grader?" << endl; 
cout << "====================================================\n\n\n" << endl; 
cout<<"Complete the quote below:\n\n"; //answer dito ay: animal
cout<<" He who does not love his own language is worse than an _____ and smelly fish\n\n";
cout<<"Do you need help?[y/n]: ";
cin>>help;
subj[0] = "";
if(help=='Y'||help=='y'){
if (peekUsed == false)
cout << "[P] for peek\n";
if (copyUsed == false)
cout << "[C] for Copy\n";
if(saveUsed == false)
cout<<"[S] for Save\n";
cout<<"Enter your choice: ";
cin>>C1;
{
if(C1=='P'||C1=='p'){
cout<<"The answer is animal";
peekUsed=true;
cout<<"\nEnter your answer: ";
cin>>A1;
correct="animal";
{
if(A1==correct)
cout<<"Correct!";

if(A1!=correct)
cout<<"Wrong answer";

}
}
if(C1=='C'||C1=='c'){
cout<<"Correct! The answer is animal ";
copyUsed=true;
}
if(C1=='S'||C1=='s'){
cout<<"Enter your answer: ";
cin>>A;
cout<<"Correct! The answer is animal";
saveUsed=true;
}
}
}
if(help=='N'||help=='n'){
cout<<"Enter your answer: ";
cin>>A1;
correct="animal";
{
if(A1==correct)
cout<<"Correct!";

if(A1!=correct)
cout<<"Wrong answer";

}
}

break;
case 2: cout << "====================================================" << endl;                   
cout << "Are you smarter than a 5th grader?" << endl; 
cout << "====================================================\n\n\n" << endl; 
cout<<"A part of a friendly letter where it states the adress of the writer and the date it was made\n\n"; //answer dito ay heading
cout<<"Do you need help?[y/n]: ";
cin>>help;
subj[1] = "";
if(help=='Y'||help=='y'){
if (peekUsed == false)
cout << "[P] for peek\n";
if (copyUsed == false)
cout << "[C] for Copy\n";
if(saveUsed == false)
cout<<"[S] for Save\n";
cout<<"Enter your choice: ";
cin>>C1;
{
if(C1=='P'||C1=='p'){
cout<<"The answer is heading";
peekUsed=true;
cout<<"\nEnter your answer: ";
cin>>A1;
correct="heading";
{
if(A1==correct)
cout<<"Correct!";

if(A1!=correct)
cout<<"Wrong answer";

}
}
if(C1=='C'||C1=='c'){
cout<<"Correct! The answer is heading ";
copyUsed=true;
}
if(C1=='S'||C1=='s'){
cout<<"Enter your answer: ";
cin>>A;
cout<<"Correct! The answer is heading";
saveUsed=true;
}
}
}
if(help=='N'||help=='n'){
cout<<"Enter your answer: ";
cin>>A1;
correct="heading";
{
if(A1==correct)
cout<<"Correct!";

if(A1!=correct)
cout<<"Wrong answer";

}
}
break;
case 3: cout << "====================================================" << endl;                   
cout << "Are you smarter than a 5th grader?" << endl; 
cout << "====================================================\n\n\n" << endl; 
cout<<"True or False:\n\n"; //answer dito ay true
cout<<"When the plural of a noun shows possession or ownership, it is in its plural possessive form\n\n";
cout<<"Do you need help?[y/n]: ";
cin>>help;
subj[2] = "";
if(help=='Y'||help=='y'){
if (peekUsed == false)
cout << "[P] for peek\n";
if (copyUsed == false)
cout << "[C] for Copy\n";
if(saveUsed == false)
cout<<"[S] for Save\n";
cout<<"Enter your choice: ";
cin>>C1;
{
if(C1=='P'||C1=='p'){
cout<<"The answer is true";
peekUsed=true;
cout<<"Enter your answer: ";
cin>>A1;
correct="true";
{
if(A1==correct)
cout<<"Correct!";

if(A1!=correct)
cout<<"Wrong answer";

}
}
if(C1=='C'||C1=='c'){
cout<<"Correct! The answer is true ";
copyUsed=true;
}
if(C1=='S'||C1=='s'){
cout<<"Enter your answer: ";
cin>>A;
cout<<"Correct! The answer is true";
saveUsed=true;
}
}
}
if(help=='N'||help=='n'){
cout<<"Enter your answer: ";
cin>>A1;
correct="true";
{
if(A1==correct)
cout<<"Correct!";

if(A1!=correct)
cout<<"Wrong answer";

}
}
break;
case 4: cout << "====================================================" << endl;                   
cout << "Are you smarter than a 5th grader?" << endl; 
cout << "====================================================\n\n\n" << endl; 
cout<<"Identify:\n\n";
cout<<"A quantity or number to be subtracted from another\n\n"; //answer dito ay subtrahend
cout<<"Do you need help?[y/n]: ";
cin>>help;
subj[3]="";
if(help=='Y'||help=='y'){
if (peekUsed == false)
cout << "[P] for peek\n";
if (copyUsed == false)
cout << "[C] for Copy\n";
if(saveUsed == false)
cout<<"[S] for Save\n";
cout<<"Enter your choice: ";
cin>>C1;
{
if(C1=='P'||C1=='p'){
cout<<"The answer is subtrahend\n";
peekUsed=true;
cout<<"Enter your answer: ";
cin>>A1;
correct="subtrahend";
{
if(A1==correct)
cout<<"Correct!";

if(A1!=correct)
cout<<"Wrong answer";

}
}
if(C1=='C'||C1=='c'){
cout<<"Correct! The answer is subtrahend";
copyUsed=true;
}
if(C1=='S'||C1=='s'){
cout<<"Enter your answer: ";
cin>>A;
cout<<"Correct! The answer is subtrahend";
saveUsed=true;
}
}
}
if(help=='N'||help=='n'){
cout<<"Enter your answer: ";
cin>>A1;
correct="subtrahend";
{
if(A1==correct)
cout<<"Correct!";

if(A1!=correct)
cout<<"Wrong answer";

}
}
break;
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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
case 5: cout << "====================================================" << endl;                   
cout << "Are you smarter than a 5th grader?" << endl; 
cout << "====================================================\n\n\n" << endl; 
cout<<"What is the imaginary line that divides the globe into Northern Hemisphere and Southern Hemisphere.\n\n"; //answer dito ay equator
	cout<<"Do you need help?[y/n]: ";
cin>>help;
subj[4]="";
if(help=='Y'||help=='y'){
if (peekUsed == false)
cout << "[P] for peek\n";
if (copyUsed == false)
cout << "[C] for Copy\n";
if(saveUsed == false)
cout<<"[S] for Save\n";
cout<<"Enter your choice: ";
cin>>C1;
{
if(C1=='P'||C1=='p'){
cout<<"The answer is equator\n";
peekUsed=true;
cout<<"Enter your answer: ";
cin>>A1;
correct="equator";
{
if(A1==correct)
cout<<"Correct!";

if(A1!=correct)
cout<<"Wrong answer";

}
}
if(C1=='C'||C1=='c'){
cout<<"Correct! The answer is equator";
copyUsed=true;
}
if(C1=='S'||C1=='s'){
cout<<"Enter your answer: ";
cin>>A;
cout<<"Correct! The answer is equator";
saveUsed=true;
}
}
}
if(help=='N'||help=='n'){
cout<<"Enter your answer: ";
cin>>A1;
correct="equator";
{
if(A1==correct)
cout<<"Correct!";

if(A1!=correct)
cout<<"Wrong answer";

}
}
break;
case 6: cout << "====================================================" << endl;                   
cout << "Are you smarter than a 5th grader?" << endl; 
cout << "====================================================\n\n\n" << endl; 
cout<<"Fill in the blanks:\n\n";
cout<<"Fractions representing numbers equal to ____ have the same numerator and denominator\n\n"; //answer dito ay one
	cout<<"Do you need help?[y/n]: ";
cin>>help;
subj[5]="";
if(help=='Y'||help=='y'){
if (peekUsed == false)
cout << "[P] for peek\n";
if (copyUsed == false)
cout << "[C] for Copy\n";
if(saveUsed == false)
cout<<"[S] for Save\n";
cout<<"Enter your choice: ";
cin>>C1;
{
if(C1=='P'||C1=='p'){
cout<<"The answer is one\n";
peekUsed=true;
cout<<"Enter your answer: ";
cin>>A1;
correct="one";
{
if(A1==correct)
cout<<"Correct!";

if(A1!=correct)
cout<<"Wrong answer";

}
}
if(C1=='C'||C1=='c'){
cout<<"Correct! The answer is one";
copyUsed=true;
}
if(C1=='S'||C1=='s'){
cout<<"Enter your answer: ";
cin>>A;
cout<<"Correct! The answer is one";
saveUsed=true;
}
}
}
if(help=='N'||help=='n'){
cout<<"Enter your answer: ";
cin>>A1;
correct="one";
{
if(A1==correct)
cout<<"Correct!";

if(A1!=correct)
cout<<"Wrong answer";

}
}
break;
case 7: cout << "====================================================" << endl;                   
cout << "Are you smarter than a 5th grader?" << endl; 
cout << "====================================================\n\n\n" << endl; 
cout<<"Region 4-A are consists of Quezon,Rizal,Cavite,Laguna,and Batangas. What is the name of these five provinces?\n\n"; //answer dito ay calabarzon
	cout<<"Do you need help?[y/n]: ";
cin>>help;
subj[6]="";
if(help=='Y'||help=='y'){
if (peekUsed == false)
cout << "[P] for peek\n";
if (copyUsed == false)
cout << "[C] for Copy\n";
if(saveUsed == false)
cout<<"[S] for Save\n";
cout<<"Enter your choice: ";
cin>>C1;
{
if(C1=='P'||C1=='p'){
cout<<"The answer is calabarzon\n";
peekUsed=true;
cout<<"Enter your answer: ";
cin>>A1;
correct="calabarzon";
{
if(A1==correct)
cout<<"Correct!";

if(A1!=correct)
cout<<"Wrong answer";

}
}
if(C1=='C'||C1=='c'){
cout<<"Correct! The answer is calabarzon";
copyUsed=true;
}
if(C1=='S'||C1=='s'){
cout<<"Enter your answer: ";
cin>>A;
cout<<"Correct! The answer is calabarzon";
saveUsed=true;
}
}
}
if(help=='N'||help=='n'){
cout<<"Enter your answer: ";
cin>>A1;
correct="calabarzon";
{
if(A1==correct)
cout<<"Correct!";

if(A1!=correct)
cout<<"Wrong answer";

}
}
break;
case 8: cout << "====================================================" << endl;                   
cout << "Are you smarter than a 5th grader?" << endl; 
cout << "====================================================\n\n\n" << endl; 
cout<<"In Music, what is composed of 5 lines and four spaces?\n\n";
	cout<<"Do you need help?[y/n]: ";
cin>>help;
subj[7]="";
if(help=='Y'||help=='y'){
if (peekUsed == false)
cout << "[P] for peek\n";
if (copyUsed == false)
cout << "[C] for Copy\n";
if(saveUsed == false)
cout<<"[S] for Save\n";
cout<<"Enter your choice: ";
cin>>C1;
{
if(C1=='P'||C1=='p'){
cout<<"The answer is staff\n";
peekUsed=true;
cout<<"Enter your answer: ";
cin>>A1;
correct="staff";
{
if(A1==correct)
cout<<"Correct!";

if(A1!=correct)
cout<<"Wrong answer";

}
}
if(C1=='C'||C1=='c'){
cout<<"Correct! The answer is staff";
copyUsed=true;
}
if(C1=='S'||C1=='s'){
cout<<"Enter your answer: ";
cin>>A;
cout<<"Correct! The answer is staff";
saveUsed=true;
}
}
}
if(help=='N'||help=='n'){
cout<<"Enter your answer: ";
cin>>A1;
correct="staff";
{
if(A1==correct)
cout<<"Correct!";

if(A1!=correct)
cout<<"Wrong answer";

}
}
break;
case 9: cout << "====================================================" << endl;                   
cout << "Are you smarter than a 5th grader?" << endl; 
cout << "====================================================\n\n\n" << endl; 
cout<<"Under which sub-group of invertebrate animals do the clam, squid, octopus and snail belong?\n\n"; //answer dito ay mollusks
	cout<<"Do you need help?[y/n]: ";
cin>>help;
subj[8]="";
if(help=='Y'||help=='y'){
if (peekUsed == false)
cout << "[P] for peek\n";
if (copyUsed == false)
cout << "[C] for Copy\n";
if(saveUsed == false)
cout<<"[S] for Save\n";
cout<<"Enter your choice: ";
cin>>C1;
{
if(C1=='P'||C1=='p'){
cout<<"The answer is mollusks\n";
peekUsed=true;
cout<<"Enter your answer: ";
cin>>A1;
correct="mollusks";
{
if(A1==correct)
cout<<"Correct!";

if(A1!=correct)
cout<<"Wrong answer";

}
}
if(C1=='C'||C1=='c'){
cout<<"Correct! The answer is mollusks";
copyUsed=true;
}
if(C1=='S'||C1=='s'){
cout<<"Enter your answer: ";
cin>>A;
cout<<"Correct! The answer is mollusks";
saveUsed=true;
}
}
}
if(help=='N'||help=='n'){
cout<<"Enter your answer: ";
cin>>A1;
correct="mollusks";
{
if(A1==correct)
cout<<"Correct!";

if(A1!=correct)
cout<<"Wrong answer";

}
}
break;
case 10: cout << "====================================================" << endl;                   
cout << "Are you smarter than a 5th grader?" << endl; 
cout << "====================================================\n\n\n" << endl; 
cout<<"Exaggerated statements or claims not meant to be taken literally\n\n"; //answer dito ay hyperbole
	cout<<"Do you need help?[y/n]: ";
cin>>help;
subj[9]="";
if(help=='Y'||help=='y'){
if (peekUsed == false)
cout << "[P] for peek\n";
if (copyUsed == false)
cout << "[C] for Copy\n";
if(saveUsed == false)
cout<<"[S] for Save\n";
cout<<"Enter your choice: ";
cin>>C1;
{
if(C1=='P'||C1=='p'){
cout<<"The answer is hyperbole\n";
peekUsed=true;
cout<<"Enter your answer: ";
cin>>A1;
correct="hyperbole";
{
if(A1==correct)
cout<<"Congratulations! You are smarter than a 5th grader!";

if(A1!=correct)
cout<<"Wrong answer";

}
}
if(C1=='C'||C1=='c'){
cout<<"Correct! The answer is hyperbole";
copyUsed=true;
}
if(C1=='S'||C1=='s'){
cout<<"Enter your answer: ";
cin>>A;
cout<<"Correct! The answer is hyperbole";
saveUsed=true;
}
}
}
if(help=='N'||help=='n'){
cout<<"Enter your answer: ";
cin>>A1;
correct="hyperbole";
{
if(A1==correct)
cout<<"Correct!";

if(A1!=correct)
cout<<"Wrong answer";

}
}

break;
}
}
}
if(play=='N'||play=='n')
cout<<"Ok thank you!";
}
if(ans=='X'||ans=='x'){
cout<<"BYE!\n";
}

return 0;
}
do you have to keep score?

if you do you can just have yet another variable say int score = 0

every time you get correct answer increment score by one

when they give wrong answer you output "Wrong answer", you can add to that code something like "Congratulations!!! Your score is: " << score;

or you can do it on the very end when the program will exit the loop because of wrong answer

PS I didn't go through your code, try to find where to put it by yourself, I don't think I have patience:P
btw do you know what a function is?

for example you repeat this:

1
2
3
cout << "====================================================" << endl;                   
cout << "Are you smarter than a 5th grader?" << endl; 
cout << "====================================================\n\n\n" << endl; 


many many times

you could just make a function and call it as many times as you want, it would save you whole bunch of typing

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

void areYouSmarter(){
cout << "====================================================" << endl;                   
cout << "Are you smarter than a 5th grader?" << endl; 
cout << "====================================================\n\n\n" << endl; 
}

int main(){

areYouSmarter();
areYouSmarter();
areYouSmarter();

return 0;
}



basically every time you find your self repeating the same thing, you should make a function

to be honest your each case is the same with the difference of correct answer that could be passed to the function

if you have time to do it before submission time have a look at this:
http://www.cplusplus.com/doc/tutorial/functions/
I still can't figure it out where to put "congratulations" because it is still looping after answering all the ten questions correctly, but anyway thanks for all the help ...
Last edited on
Topic archived. No new replies allowed.
Pages: 12