Tips on Multiple choice quiz

does any one know how to get the RNG to generate multiple choices for a problem and have the RNG also decide which of the choices is the correct one for problem.

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
        int num1;
	int num2;
	int A;
	int B;
	int C;
	int D;
	int correct_answer = 0;
	num1 = 0;
	num2 = 0;
	number_correct = 0;
	A = 0;
	B = 0;
	C = 0;
	D = 0;
	
	num1 = 1 + rand() % 9;
	num2 = 1 + rand() % 9;
	A = 1 + rand() % 17;
	B = 1 + rand() % 17;
	C = 1 + rand() % 17;
	D = 1 + rand() % 17;
	A != B, C, D;
	B != A, C, D;
	C != A, B, D;
	D != A, B, C;
			
		
	cout << num1 << endl
	     << "+" << num2 << endl;
	cout << endl << endl;
	correct_answer = num1 + num2;
	cout << "A." << num1 << " + " << num2 << " = " << A << endl;
	cout << "B." << num1 << " + " << num2 << " = " << B << endl;
	cout << "C." << num1 << " + " << num2 << " = " << C << endl;
	cout << "D." << num1 << " + " << num2 << " = " << D << endl;
	cout << "E.	None of the above" << endl;
	cin >> given_answer;
	     do
	     {
	       attempts = 0;
	       question_num = 0;
	       switch (given_answer)
		{
		case 'A':
		case 'a':
		if (given_answer == correct_answer && given_answer == A)
		   cout << "Correct"
			<< system("pause")
			<< number_correct++
			<< question_num++;
		else if (given_answer != correct_answer && given_answer == A)
		    cout << "Wrong"
			<< system("pause")
			<< number_wrong++
			<< attempts++;
			break;
		case 'B':
		case 'b':
		if (given_answer == correct_answer && given_answer == B)
		   cout << "Correct"
			<< system("pause")
			<< number_correct++
			<< question_num++;
		else if (given_answer != correct_answer && given_answer == B)
		    cout << "Wrong"
			<< system("pause")
			<< number_wrong++
			<< attempts++;
			break;
		case 'C':
		case 'c':
		if (given_answer == correct_answer && given_answer == C)
			cout << "Correct"
		             << system("pause")
			     << number_correct++
		             << question_num++;
		else if (given_answer != correct_answer && given_answer == C)
			cout << "Wrong"
		             << system("pause")
			     << number_wrong++
			     << attempts++;
			break;
		case 'D':
		case 'd':
		if (given_answer == correct_answer && given_answer == D)
			cout << "Correct"
			     << system("pause")
			     << number_correct++
			     << question_num++;
		else if (given_answer != correct_answer && given_answer == D)
			cout << "Wrong"
			     << system("pause")
			     << number_wrong++
			     << attempts++;
			break;
		case 'E':
		case 'e':
		if (given_answer != A ||
		given_answer != B ||
		given_answer != C ||
		given_answer != D)
			cout << "Correct"
			<< system("pause")
			<< number_correct++
			<< question_num++;
		else if (given_answer == A ||
		given_answer == B ||
		given_answer == C ||
		given_answer == D)
			cout << "Wrong"
			<< system("pause")
			<< number_wrong++
			<< attempts++;
			break;
		default:
			cout << "Please enter vaild choice";
			break;
		}
	} while (attempts <= 3 || question_num == 10);
	}


I have this code within a loop that will give the user 3 chances to get the question right before it will cout that they got the question wrong and then keep asking questions for a total of 10 questions.
Am I on the right track or can someone explain to me what I did wrong.
I also wanted to state that I did seed the RNG in this code.

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
#include <iostream>
#include <string>

using namespace std;

char seed;
int seednumber;


main()
{
	cout << " do you want to seed the random number generator" << endl
		<< "Y for yes N for no" << endl;
	cin >> seed;
	switch (seed)// Switch to seed RNG
	{
	case 'Y':
	case 'y':
		cout << "choose a number" << endl;
		cout << endl << endl;
		cin >> seednumber;
		srand(seednumber);
		break;
	case'N':
	case'n':
		cout << "then we'll use a random number" << endl;
		cout << endl << endl;
		srand(time(0));
		seednumber = time(0);
		break;
	default:
		cout << "that is not a vaild Response" << endl;
		cin >> seed;
	}
return 0;
}



I do have more to my code, like functions but this is the bones of it. Thanks in advance to anyone that can help.
Topic archived. No new replies allowed.