Answer to Question #20850 in C++ for fuji

Question #20850
Addition, Subtraction and Multiplication
The program can be used as a math tutor for a young student. The program should display two random numbers between 1 and 9. After the student has entered an answer, the program should display the correct answer so the student can see if his/her answer is correct.
1
Expert's answer
2012-12-20T07:54:44-0500
#include <iostream>
#include <cstdlib>
#include <time.h>
using namespace std;

int main()
{


srand ( time(NULL) );
int i,j;


i=rand()%9;
j=rand()%9;
int m=i*j;

cout<<"please ask the question"<<j<<"*"<<i<<"=?"<<endl;
int k;
cin>>k;

if(k!=m) {
& cout<<"foulse"<<endl;
& cout<<j<<"*"<<i<<"="<<m<<endl;}
& else{cout<<"true"<<endl;}
cout<<"i="<<i<<" & j="<<j<<endl;


return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS