Rand for different results

This is my code so far, I need help on the line I commented //help on. I am trying to get the feedback to display 4 different ways for example great job, well done, excellent and good. Whenever the user gets the correct answer. I also need to do it for the wrong responses. How would I do this? Try to make the code basic as possible I'm still new. I think Ik how to do this but not sure.


#include "stdafx.h"
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;



int main()

{
int userGuess, answer, num1, num2, totalCorrect;
cout << "Welcome to the addition game!" << endl;
cout << "Calculate the problems below, when finished type -1 to view results.\n\n";


unsigned seed = time(0);
srand(seed);
num1 = 1 + rand() % 10; // first random number for the adding problem
num2 = 1 + rand() % 10; // second random number for the adding problem



cout << " What is " << num1 << "+" << num2 << "?";
cin >> userGuess;


if (userGuess == num1 + num2)
cout << "Great Job! "; //HELP


else
cout << "Wrong! " << endl; // HELP


return 0;
}
Use a loop.
1
2
while (userGuess != -1)
...

You should give your variables an initial value
 
int userGuess = 0, answer = 0, ...
Topic archived. No new replies allowed.