HELP PLEASE :) C++ i am a novice at this ... so use simple terms ... :)

Im writing a multiple choice test and i have the questions down but i cant get the grading done. i need to use a switch and loop still. how will i incorporate these to find the percentage score. PLEASE HELP .


// Multiple Choice Test for Final

#include <iostream.h>
#include <iomanip.h>
main()
{
char choice, x, Correct, Incorrect;

cout << "Mathematics Exam: Please choose the best answer. Take your time as you will only have one chance to amswer each question.\n";
cout << "Find x.\n";

cout << "1. 10 / 2 = x \n";
cout << "A) 8\n";
cout << "B) 5\n";
cout << "C) 0\n";
cout << "D) 10\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'B')
{cout << "Incorrect. The answer is B.\n";}
else
{cout << "Correct.\n";}

cout << "2. 5 / 2 = x \n";
cout << "A) 2.5555555\n";
cout << "B) 2\n";
cout << "C) 2.500000\n";
cout << "D) None of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;


if (choice != 'C')
{cout << "Incorrect. The answer is C.\n";}
else
{cout << "Correct.\n";}

cout << "3. 9 / x = 2 \n";
cout << "A) 4.50\n";
cout << "B) 4\n";
cout << "C) 3.95\n";
cout << "D) none of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'A')
{cout << "Incorrect. The answer is A.\n";}
else
{cout << "Correct.\n";}

cout << "4. x / 5 = 20 \n";
cout << "A) 100.0\n";
cout << "B) 10000 * 0.01\n";
cout << "C) 10^2\n";
cout << "D) All of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'D')
{cout << "Incorrect. The answer is D.\n";}
else
{cout << "Correct.\n";}

cout << "5. x ^ 2 = 144\n";
cout << "A) 12\n";
cout << "B) -12\n";
cout << "C) 14\n";
cout << "D) Both A and B\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'D')
{cout << "Incorrect. The answer is D.\n";}
else
{cout << "Correct.\n";}

cout << "6. 2 + (2^0) = x \n";
cout << "A) 4\n";
cout << "B) 3\n";
cout << "C) 0\n";
cout << "D) None of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'B')
{cout << "Incorrect. The answer is B.\n";}
else
{cout << "Correct.\n";}

cout << "7. 90/30 = x\n";
cout << "A) 3\n";
cout << "B) 30\n";
cout << "C) 13\n";
cout << "D) None of the above.\n";
cout << "Enter the letter of the number you have chosen. ";
cin >> choice;

if (choice != 'A')
{cout << "Incorrect. The answer is A.\n";}
else
{cout << "Correct.\n";}

cout << "8. 1+1 = x\n";
cout << "A) 2\n";
cout << "B) 1\n";
cout << "C) 0\n";
cout << "D) None of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'A')
{cout << "Incorrect. The answer is A.\n";}
else
{cout << "Correct.\n";}

cout << "9. (10^1099) / (1^100)\n";
cout << "A) 10332543235\n";
cout << "B) ERR: OVERFLOW\n";
cout << "C) 50000000000000000000\n";
cout << "D) 10^1099\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'D')
{cout << "Incorrect. The answer is D.\n";}
else
{cout << "Correct.\n";}

cout << "10. x! = 362880\n"; //10
cout << "A) 10\n";
cout << "B) 9\n";
cout << "C) 8\n";
cout << "D) All of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'B')
{cout << "Incorrect. The answer is B.\n";}
else
{cout << "Correct.\n";}

cout << "11. 12+1 = x\n";
cout << "A) 13\n";
cout << "B) 12\n";
cout << "C) 11\n";
cout << "D) None of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'A')
{cout << "Incorrect. The answer is A.\n";}
else
{cout << "Correct.\n";}

cout << "12. 45 = 9x\n";
cout << "A) 5\n";
cout << "B) 9\n";
cout << "C) 7\n";
cout << "D) None of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'A')
{cout << "Incorrect. The answer is A.\n";}
else
{cout << "Correct.\n";}

cout << "13. 5 * (7^2) = x\n";
cout << "A) 240\n";
cout << "B) 345\n";
cout << "C) 245\n";
cout << "D) None of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'C')
{cout << "Incorrect. The answer is C.\n";}
else
{cout << "Correct.\n";}

cout << "14. 1 * 1 = x\n";
cout << "A) 2\n";
cout << "B) 1\n";
cout << "C) 0\n";
cout << "D) None of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'B')
{cout << "Incorrect. The answer is B.\n";}
else
{cout << "Correct.\n";}

cout << "15. 18:3 = x:9\n";
cout << "A) 36\n";
cout << "B) 72\n";
cout << "C) 54\n";
cout << "D) None of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'c')
{cout << "Incorrect. The answer is C.\n";}
else
{cout << "Correct.\n";}

cout << "16. 92+0 = x\n";
cout << "A) 92\n";
cout << "B) 90\n";
cout << "C) 0\n";
cout << "D) None of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'A')
{cout << "Incorrect. The answer is A.\n";}
else
{cout << "Correct.\n";}

cout << "17. 7^3 = x\n";
cout << "A) 288\n";
cout << "B) 343\n";
cout << "C) 340\n";
cout << "D) None of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'B')
{cout << "Incorrect. The answer is B.\n";}
else
{cout << "Correct.\n";}

cout << "18. 1 * 0.5 = x\n";
cout << "A) .05\n";
cout << "B) 0.5\n";
cout << "C) 1/2\n";
cout << "D) Both B and C\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'D')
{cout << "Incorrect. The answer is D.\n";}
else
{cout << "Correct.\n";}

cout << "19. 3! = x\n";
cout << "A) 6\n";
cout << "B) 1\n";
cout << "C) 9\n";
cout << "D) None of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'A')
{cout << "Incorrect. The answer is A.\n";}
else
{cout << "Correct.\n";}

cout << "20. 9090909090909090 * b^0 = x\n";
cout << "A) \n";
cout << "B) 9090909090909090\n";
cout << "C) Not enough information\n";
cout << "D) None of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'B')
{cout << "Incorrect. The answer is B.\n";}
else
{cout << "Correct.\n";}

double percentage = (Correct/20)*100;

system ("pause");
return 0;
}
Can you repost it in code tags, please ?
how do i do that ??
Look at the format bar to the right of where you write your comment. Click on the '<>' button, and insert your code between the code brackets.
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
// Multiple Choice Test for Final

#include <iostream.h>
#include <iomanip.h>
main()
{
char choice, x, Correct, Incorrect;

cout << "Mathematics Exam: Please choose the best answer. Take your time as you will only have one chance to amswer each question.\n";
cout << "Find x.\n";

cout << "1. 10 / 2 = x \n"; 
cout << "A) 8\n";
cout << "B) 5\n";
cout << "C) 0\n";
cout << "D) 10\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'B')
{cout << "Incorrect. The answer is B.\n";}
else 
{cout << "Correct.\n";}

cout << "2. 5 / 2 = x \n";
cout << "A) 2.5555555\n";
cout << "B) 2\n";
cout << "C) 2.500000\n";
cout << "D) None of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;


if (choice != 'C')
{cout << "Incorrect. The answer is C.\n";}
else
{cout << "Correct.\n";}

cout << "3. 9 / x = 2 \n";
cout << "A) 4.50\n";
cout << "B) 4\n";
cout << "C) 3.95\n";
cout << "D) none of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'A')
{cout << "Incorrect. The answer is A.\n";}
else
{cout << "Correct.\n";}

cout << "4. x / 5 = 20 \n";
cout << "A) 100.0\n";
cout << "B) 10000 * 0.01\n";
cout << "C) 10^2\n";
cout << "D) All of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'D')
{cout << "Incorrect. The answer is D.\n";}
else
{cout << "Correct.\n";}

cout << "5. x ^ 2 = 144\n";
cout << "A) 12\n";
cout << "B) -12\n";
cout << "C) 14\n";
cout << "D) Both A and B\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'D')
{cout << "Incorrect. The answer is D.\n";}
else
{cout << "Correct.\n";}

cout << "6. 2 + (2^0) = x \n";
cout << "A) 4\n";
cout << "B) 3\n";
cout << "C) 0\n";
cout << "D) None of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'B')
{cout << "Incorrect. The answer is B.\n";}
else
{cout << "Correct.\n";}

cout << "7. 90/30 = x\n";
cout << "A) 3\n";
cout << "B) 30\n";
cout << "C) 13\n";
cout << "D) None of the above.\n";
cout << "Enter the letter of the number you have chosen. ";
cin >> choice;

if (choice != 'A')
{cout << "Incorrect. The answer is A.\n";}
else
{cout << "Correct.\n";}

cout << "8. 1+1 = x\n";
cout << "A) 2\n";
cout << "B) 1\n";
cout << "C) 0\n";
cout << "D) None of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'A')
{cout << "Incorrect. The answer is A.\n";}
else
{cout << "Correct.\n";}

cout << "9. (10^1099) / (1^100)\n";
cout << "A) 10332543235\n";
cout << "B) ERR: OVERFLOW\n";
cout << "C) 50000000000000000000\n";
cout << "D) 10^1099\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'D')
{cout << "Incorrect. The answer is D.\n";}
else
{cout << "Correct.\n";}

cout << "10. x! = 362880\n"; //10
cout << "A) 10\n";
cout << "B) 9\n";
cout << "C) 8\n";
cout << "D) All of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'B')
{cout << "Incorrect. The answer is B.\n";}
else
{cout << "Correct.\n";}

cout << "11. 12+1 = x\n";
cout << "A) 13\n";
cout << "B) 12\n";
cout << "C) 11\n";
cout << "D) None of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'A')
{cout << "Incorrect. The answer is A.\n";}
else
{cout << "Correct.\n";}

cout << "12. 45 = 9x\n";
cout << "A) 5\n";
cout << "B) 9\n";
cout << "C) 7\n";
cout << "D) None of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'A')
{cout << "Incorrect. The answer is A.\n";}
else
{cout << "Correct.\n";}

cout << "13. 5 * (7^2) = x\n";
cout << "A) 240\n";
cout << "B) 345\n";
cout << "C) 245\n";
cout << "D) None of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'C')
{cout << "Incorrect. The answer is C.\n";}
else
{cout << "Correct.\n";}

cout << "14. 1 * 1 = x\n";
cout << "A) 2\n";
cout << "B) 1\n";
cout << "C) 0\n";
cout << "D) None of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'B')
{cout << "Incorrect. The answer is B.\n";}
else
{cout << "Correct.\n";}

cout << "15. 18:3 = x:9\n";
cout << "A) 36\n";
cout << "B) 72\n";
cout << "C) 54\n";
cout << "D) None of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'c')
{cout << "Incorrect. The answer is C.\n";}
else
{cout << "Correct.\n";}

cout << "16. 92+0 = x\n";
cout << "A) 92\n";
cout << "B) 90\n";
cout << "C) 0\n";
cout << "D) None of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'A')
{cout << "Incorrect. The answer is A.\n";}
else
{cout << "Correct.\n";}

cout << "17. 7^3 = x\n";
cout << "A) 288\n";
cout << "B) 343\n";
cout << "C) 340\n";
cout << "D) None of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'B')
{cout << "Incorrect. The answer is B.\n";}
else
{cout << "Correct.\n";}

cout << "18. 1 * 0.5 = x\n";
cout << "A) .05\n";
cout << "B) 0.5\n";
cout << "C) 1/2\n";
cout << "D) Both B and C\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'D')
{cout << "Incorrect. The answer is D.\n";}
else
{cout << "Correct.\n";}

cout << "19. 3! = x\n";
cout << "A) 6\n";
cout << "B) 1\n";
cout << "C) 9\n";
cout << "D) None of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'A')
{cout << "Incorrect. The answer is A.\n";}
else
{cout << "Correct.\n";}

cout << "20. 9090909090909090 * b^0 = x\n";
cout << "A) \n";
cout << "B) 9090909090909090\n";
cout << "C) Not enough information\n";
cout << "D) None of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'B')
{cout << "Incorrect. The answer is B.\n";}
else
{cout << "Correct.\n";}

double percentage = (Correct/20)*100;

system ("pause");
return 0;
}
Last edited on
Nope. Put your code in the middle of the two sets of square brackets, not inside the first one!
More importantly, what output are you seeing?

...from the looks of it, you have two variables, Incorrect and Correct. Both of them are uninitialized. For each response, you should increment one of the two to track the results. Then, you want to divide by a double so that it doesn't do integral division.

Here's an example, since you're so close:
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
#include <iostream>
using namespace std;

int main()
{
    char choice;
    int correct = 0;

    cout << "Make sure you use capital letters when answering...\n";

    cout << "Find x." << endl;
    cout << "1. 10 / 2 = x" << endl;
    cout << "A) 8" << endl;
    cout << "B) 5" << endl;
    cout << "C) 0" << endl;
    cout << "D) 10" << endl;
    cout << "Enter the letter of the answer you have chosen: ";
    cin >> choice;

    if( choice != 'B' ) {
        cout << "Incorrect. The answer is B." << endl;
    } else {
        cout << "Correct!" << endl;
        ++correct;
    }

    //...

    double percentage = (correct / 1.0) * 100;

    system ("pause");
    return 0;
}

Last edited on
Try this:
[code]int n;[/code]

Displays as:
int n;
No he means like this (use [ code ] Your code in here...[/ code] without spaces):
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
// Multiple Choice Test for Final

#include <iostream.h>
#include <iomanip.h>
main()
{
char choice, x, Correct, Incorrect;

cout << "Mathematics Exam: Please choose the best answer. Take your time as you will only have one chance to amswer each question.\n";
cout << "Find x.\n";

cout << "1. 10 / 2 = x \n";
cout << "A) 8\n";
cout << "B) 5\n";
cout << "C) 0\n";
cout << "D) 10\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'B')
{cout << "Incorrect. The answer is B.\n";}
else
{cout << "Correct.\n";}

cout << "2. 5 / 2 = x \n";
cout << "A) 2.5555555\n";
cout << "B) 2\n";
cout << "C) 2.500000\n";
cout << "D) None of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;


if (choice != 'C')
{cout << "Incorrect. The answer is C.\n";}
else
{cout << "Correct.\n";}

cout << "3. 9 / x = 2 \n";
cout << "A) 4.50\n";
cout << "B) 4\n";
cout << "C) 3.95\n";
cout << "D) none of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'A')
{cout << "Incorrect. The answer is A.\n";}
else
{cout << "Correct.\n";}

cout << "4. x / 5 = 20 \n";
cout << "A) 100.0\n";
cout << "B) 10000 * 0.01\n";
cout << "C) 10^2\n";
cout << "D) All of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'D')
{cout << "Incorrect. The answer is D.\n";}
else
{cout << "Correct.\n";}

cout << "5. x ^ 2 = 144\n";
cout << "A) 12\n";
cout << "B) -12\n";
cout << "C) 14\n";
cout << "D) Both A and B\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'D')
{cout << "Incorrect. The answer is D.\n";}
else
{cout << "Correct.\n";}

cout << "6. 2 + (2^0) = x \n";
cout << "A) 4\n";
cout << "B) 3\n";
cout << "C) 0\n";
cout << "D) None of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'B')
{cout << "Incorrect. The answer is B.\n";}
else
{cout << "Correct.\n";}

cout << "7. 90/30 = x\n";
cout << "A) 3\n";
cout << "B) 30\n";
cout << "C) 13\n";
cout << "D) None of the above.\n";
cout << "Enter the letter of the number you have chosen. ";
cin >> choice;

if (choice != 'A')
{cout << "Incorrect. The answer is A.\n";}
else
{cout << "Correct.\n";}

cout << "8. 1+1 = x\n";
cout << "A) 2\n";
cout << "B) 1\n";
cout << "C) 0\n";
cout << "D) None of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'A')
{cout << "Incorrect. The answer is A.\n";}
else
{cout << "Correct.\n";}

cout << "9. (10^1099) / (1^100)\n";
cout << "A) 10332543235\n";
cout << "B) ERR: OVERFLOW\n";
cout << "C) 50000000000000000000\n";
cout << "D) 10^1099\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'D')
{cout << "Incorrect. The answer is D.\n";}
else
{cout << "Correct.\n";}

cout << "10. x! = 362880\n"; //10
cout << "A) 10\n";
cout << "B) 9\n";
cout << "C) 8\n";
cout << "D) All of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'B')
{cout << "Incorrect. The answer is B.\n";}
else
{cout << "Correct.\n";}

cout << "11. 12+1 = x\n";
cout << "A) 13\n";
cout << "B) 12\n";
cout << "C) 11\n";
cout << "D) None of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'A')
{cout << "Incorrect. The answer is A.\n";}
else
{cout << "Correct.\n";}

cout << "12. 45 = 9x\n";
cout << "A) 5\n";
cout << "B) 9\n";
cout << "C) 7\n";
cout << "D) None of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'A')
{cout << "Incorrect. The answer is A.\n";}
else
{cout << "Correct.\n";}

cout << "13. 5 * (7^2) = x\n";
cout << "A) 240\n";
cout << "B) 345\n";
cout << "C) 245\n";
cout << "D) None of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'C')
{cout << "Incorrect. The answer is C.\n";}
else
{cout << "Correct.\n";}

cout << "14. 1 * 1 = x\n";
cout << "A) 2\n";
cout << "B) 1\n";
cout << "C) 0\n";
cout << "D) None of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'B')
{cout << "Incorrect. The answer is B.\n";}
else
{cout << "Correct.\n";}

cout << "15. 18:3 = x:9\n";
cout << "A) 36\n";
cout << "B) 72\n";
cout << "C) 54\n";
cout << "D) None of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'c')
{cout << "Incorrect. The answer is C.\n";}
else
{cout << "Correct.\n";}

cout << "16. 92+0 = x\n";
cout << "A) 92\n";
cout << "B) 90\n";
cout << "C) 0\n";
cout << "D) None of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'A')
{cout << "Incorrect. The answer is A.\n";}
else
{cout << "Correct.\n";}

cout << "17. 7^3 = x\n";
cout << "A) 288\n";
cout << "B) 343\n";
cout << "C) 340\n";
cout << "D) None of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'B')
{cout << "Incorrect. The answer is B.\n";}
else
{cout << "Correct.\n";}

cout << "18. 1 * 0.5 = x\n";
cout << "A) .05\n";
cout << "B) 0.5\n";
cout << "C) 1/2\n";
cout << "D) Both B and C\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'D')
{cout << "Incorrect. The answer is D.\n";}
else
{cout << "Correct.\n";}

cout << "19. 3! = x\n";
cout << "A) 6\n";
cout << "B) 1\n";
cout << "C) 9\n";
cout << "D) None of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'A')
{cout << "Incorrect. The answer is A.\n";}
else
{cout << "Correct.\n";}

cout << "20. 9090909090909090 * b^0 = x\n";
cout << "A) \n";
cout << "B) 9090909090909090\n";
cout << "C) Not enough information\n";
cout << "D) None of the above\n";
cout << "Enter the letter of the answer you have chosen. ";
cin >> choice;

if (choice != 'B')
{cout << "Incorrect. The answer is B.\n";}
else
{cout << "Correct.\n";}

double percentage = (Correct/20)*100;

system ("pause");
return 0;
} 
Last edited on by closed account z6A9GNh0
I need something like this but the questions and choices are supposed to be in a text file, and the console is supposed to read it.
Topic archived. No new replies allowed.