Generate 2 random integers (one within 50 and the next one within 100) and ask the user to input the correct added value of the 2 integers. If the answer is incorrect, display "Your answer is wrong. The correct answer is ....". Here is the code for the above program:
int number1, number2;
int count = 0, correctCount = 0;
while (count < 10) {
number1 = rand() % 51;
number2 = rand() % 101;
int answer;
cin >> answer;
if (number1 + number2 != answer) {
cout << "Wrong answer." << endl;
cout << "Your correct answer is " << number1 + number2 << endl;
} else {
correctCount++;
}
count++;
}