random being repeated

Hi! So I have a code here. The objective is to create a multiple choice quiz where questions are coming from a text file and will be picked randomly to be displayed. I was able to do a multiple choice, the problem is when it generates, the question that was already pick and displayed are being displayed again. Also the choices are coming from the answers on the text file, but the problem is the choices are being displayed repeatedly in a question.

So I want to know how to not display the pick question again, and how the choices are not being displayed repeatedly.

Example output
1. what month do we celebrate Christmas?
a.december
b.december
c.january
d.december

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
  //Randomizes the questionList vector
	          random_shuffle(questionList.begin(), questionList.end());

	          //Goes through every Test question
	          for(int i = 0; i < questionList.size(); i++){

		      vector <Test> randomAnswer;
		
		      //Puts the correct Answer into it first
		      randomAnswer.push_back(questionList[i]);

		      //Then randomly gets 3 other answers from questionList
              while(randomAnswer.size() < 4)
              {
        	  int random = rand();
         	  if(random != i){
	      	  randomAnswer.push_back(questionList[rand() % (questionList.size() - 1)]);
       	     }
            
//Shuffle the answers
random_shuffle(randomAnswer.begin(), randomAnswer.end());

//Print the question
cout << questionList[i].getQuestion() << ":" << endl;

//Initialize the first choice character to 'A'
char ch = 'A';

//Prints the shuffled answers
for(int j = 0; j < randomAnswer.size(); j++)
        {
        cout << ch << ") " << randomAnswer[j].getAnswer() << endl;

			//Increment 'A' so it can print 'B' and so forth
			++ch;
		}

		//Get users response
		cout << "\nYour answer: ";
		cin  >> response;

		//Bool data type to determine if the correct answer was found
		bool isCorrect = false;

		switch(toupper(response))
        {
			case 'A':
				if(randomAnswer[0].getAnswer() == questionList[i].getAnswer())
					isCorrect = true;
				break;
			case 'B':
				if(randomAnswer[1].getAnswer() == questionList[i].getAnswer())
					isCorrect = true;
				break;
			case 'C':
				if(randomAnswer[2].getAnswer() == questionList[i].getAnswer())
					isCorrect = true;
				break;
			case 'D':
				if(randomAnswer[3].getAnswer() == questionList[i].getAnswer())
					isCorrect = true;
				break;
			default:
				cout << "\nIncorrect input.\n";
		}

		//If the answer was found print "Correct" else "Wrong"
		if(isCorrect)
        {
			cout << "\nYou got the answer correct!\n";
		}
		else
        {
			cout << "\nYou got the answer WRONG!\n"
				 << "Correct answer was " << questionList[i].getAnswer() << endl;
Topic archived. No new replies allowed.