98 947
Assignments Done
98.8%
Successfully Done
In May 2021

# Answer to Question #14575 in Action Script | Flash | Flex | ColdFusion for kateriina Ai

Question #14575
Right program that will help an elementary school student learn multiplication. Use rand (a built-in C under stdlib.h) to produce two positive 1-digit integers. It should type a question such as: How much is 6 times 7? The student type the answer. Your program checks the correct answer. An input of -1, the program will end. The ff. are the random comments. Responses to a correct answer: Very good, Excellent, Nice work, Keep up the good work. Responses to a wrong answer: No, please try again, Wrong, try once more, Don't give up, Keep on trying.
1
2012-11-08T07:13:26-0500
#include <iostream>
#include <conio.h>
using namespace std;
int main ()
{
int first, second, result, userInput = 0;
while (userInput != -1){
first = 1 + rand() % 10;
second = 1 + rand() % 10;
result = first * second;
cout << first << " times "<< second << " = " ;
cin >> userInput;
int randComment = 0;
if (userInput == result) {
randComment = 1 + rand()% 4;
if (randComment == 1){
cout << "Very good"<< endl;
}
if (randComment == 2){
cout << "Excellent"<< endl;
}
if (randComment == 3){
cout << "Nice work"<< endl;
}
if (randComment == 4){
cout << "Keep up the good work" << endl;
}
} else {
randComment = 1 + rand()% 3;
if (randComment == 1){
cout << "No, please try again" << endl;
}
if (randComment == 2){
cout << "Wrong, try once more" << endl;
}
if (randComment == 3){
cout << "Don't give up, Keep on trying" << endl;
}
}
}
system("pause");
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!