Question: This is a simple C++ program I made. This program is designed to help a elementary student learn the multiplication tables. The program will output
This is a simple C++ program I made. This program is designed to help a elementary student learn the multiplication tables. The program will output two positive one digit integers and then, the student types the answer. If it is correct, the program will print "Very good". If it is incorrect, the program will print "No. Please try again." and will ask the same question. Everything works correctly. However, I need to put a programmer defined function besides rand() inside the program and I don't know how to do that. Please Help.
#include
#include
#include
#include
using namespace std;
int main()
{
char yes;
int answer, digit1, digit2, run, sentinel = -1, temp1, temp2;
srand((unsigned int)time(NULL));
cout
cout
cout
cin >> yes;
if (yes != 'Y' && yes != 'y')
{
cout
cin >> yes;
}
do
{
digit1 = rand() % 9 + 0;
digit2 = rand() % 9 + 0;
temp1 = digit1;
temp2 = digit2;
cout
cin >> answer;
if (answer == sentinel)
return 0;
if (answer == digit1*digit2)
cout
if (answer != digit1*digit2)
{
do
{
cout
cout
cin >> answer;
} while (answer != temp1*temp2);
}
} while (answer != sentinel);
return 0;
} 
#include iostream #include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
