Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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;

} image text in transcribed

#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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Datacasting How To Stream Databases Over The Internet

Authors: Jessica Keyes

1st Edition

007034678X, 978-0070346789

More Books

Students also viewed these Databases questions