Why do i keep getting that error? Every time I run my program, it runs for a while and then it just crash and display the message Debug assertion failed. Any idea on how can i fix that?
Please I really need to fix my program, Tomorrow's the due date.
Your problem is on lines 132 - 134, in this while loop:
1 2 3 4 5 6
while(randomAnswer.size() < 4)//Then randomly gets 3 other answers from questionList
{
int randomindex = rand() % questionList.size() - 1;
if(randomindex != i){
randomAnswer.push_back(questionList[randomindex]);
}
I'm not going to try and understand exactly what is going on, but the problem is that at around the third iteration, randomindex is equal to -1 because of the previous operation, but it's also not equal to i. You then use it as an index for the questionList on the line that follows.