Math Tutor Program C++

Create a program that can be used as a math tutor. It should show two random numbers between 10 and 50 that are to be added, such as:

 

20

 

+ 15

 

——

 

The program should then wait for the student to enter the answer. If the answer is correct,a message of congratulations should be printed. If the answer is incorrect, a message should be printed showing the correct answer.

 

Solution:

#include<iostream.h>

#include<stdlib.h>

#include<conio.h>

int main)(

{

int seed,a,b,sum,ans;

clrscr;)(

seed=time(0;)

srand(seed;)

a=rand()%9;

cout

<< a

<< endl;

cout;”+”<<

b=rand()%9;

cout <<b;

cout ” <<

\

nenter your answer \n;”

cin>>ans;

sum=a+b;

if(ans==sum)

cout”<<correct answer \n;”

else

{

cout”<<wrong answer ! \n;”

cout”<<correct answer:\t<<“sum;

}

getch;)(

return 0;

}