I was asked to write a c++ program to generates random math problems.
Here's my code so far. It works, but it's not the result that i want. Right now it only generates random numbers for the math problem, but what should i do to make it generates random math problems( addition, subtraction, and, multiplication) each time it runs ??
Please help..
#include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
int main ()
{ int MAX = 10;
int right_number;
int a;
int b;
srand(time (0));
a = 1 + rand() % MAX;
b = 1 + rand() % MAX;
cout <<"please add these two numbers"<<endl;
cout <<" "<<endl<<endl<<endl;
cout <<" "<< a <<endl;
cout <<" "<< b <<endl;
cout <<"+____"<<endl;
cout <<"what is the correct answer?";
cin >>right_number;
while (right_number != (a + b))
{
cout <<"Sorry, that's not it." << endl;