#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <ctime>
usingnamespace std;
int main()
{
int num1, //holds random numbers
num2;
int answer; //holds the solution
char ch; //holds a character for finishing the program
//min and max random number values
constint maxValue = 300;
constint minValue = 1;
//get the system time
unsigned seed = time(0);
//seed the random number generator
srand(seed);
//finds num1 and assigns the value to num1
num1 = rand() % maxValue + minValue;
//finds num2 and assigns the value to num2
num2 = rand() % maxValue + minValue;
//displays the problem for the user to solve
cout << right << setw(4) << num1 << endl;
cout << "+" << num1 << endl;
//holds the program until user presses a key
cout << "Press the ENTER key when finished solving" << endl;
cin.get(ch);
//calculates the answer to num1 + num2
answer = num1 + num2;
//displays the answer
cout << "The answer is " << answer << "." << endl;
return 0;
}
however, i did some tests on a separate program and it worked fine.
The problem is that you aren't outputting num2 in line 34. You are still outputting num1. You just have to change that. Both numbers are different. But yes. You are outputting num1 + num1.