I am using this code to ask the user multiple addition question by using a do while loop. It works fine but the question are the same every time and the numbers do not change from question to question. It is different every time the code is run but the same question in each code like so:
What is 4+7?
11
Correct!
What is 4+7?
11
Correct!
etc. etc.
So i am asking how to make the numbers different every loop.
The randomization is happening outside of your loop. Have it done within the loop and you should have different values each time. After all, as you have it now, the values are assigned to num and num2 one time so they will always be the same.
int num;
int num2;
int answer;
cout << "Welcome to the RANDOM math game." << endl;
cout << "Each time is a new expierence." << endl;
cout << endl;
do{
int num = rand()%40+1;
int num2 = rand()%15;
and when i run the code it stops at the first one. Is this because when it reruns the loop the numbers change so it is no longer equal and it stops?
Ok. I do not know much about all the include stuff. So the code above does what at the end? I see it asks you if you want to continue, but what is after that?