Hi all, I'm newish to c++ and am having trouble with an array. Essentially I'm writing a program where a random number is chosen, and then it checks if that number is found in an array. If found, it ends the loop and adds it to the array, otherwise it picks a new number and tries again.
Currently, all it does is output debug over and over.
What it should do is log debug a few times and then Question found and stop doing anything. I'm happy to provide more information as needed.
while (foundQuestion == false)
{
srand(time(0));
questionNumber = 1 + (rand() % totalQuestionNumber);
cout << "Debug";
for(int i = 0; i < 500; i++)
{
if(askedQuestions[i] == questionNumber)
{
cout << "Question found";
foundQuestion = true;
}
}
}
foundQuestion = false;
questionAskedCount++;