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;

} This is a simple C++ program I made. This program is designed

#include iostream #include #include #include using namespace std; in main() char yes; int, answer, digit!, digit2, run, sentinel = -1, temp1, temp2; scand.(unsigned int)time (NULL)) Sout > yes; aut yes; digit rand() % 9 + 0; digit2 -rand() % 9 + 0; temp1 = digit|; temp2 = digit2; sin >answer; if (answersentinel) if (answerdigit1*digit2) if ( answer != digit|*digit2) return 0; SRU answer; } while (answer != temp1*temp2) } while (answer-sentinel);! return 0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!