66 897
Assignments Done
99,1%
Successfully Done
In October 2018

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.
Expert's answer
#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 first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions