Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem: Write a program that will help an elementary school student to learn division with a remainder. Use rand to produce two positive integers, the

image text in transcribed
image text in transcribed
Problem: Write a program that will help an elementary school student to learn division with a remainder. Use rand to produce two positive integers, the first one as dividend has two digits (10-99) and the second one as divisor has one digit (2-9). The program should then output a question using the numbers, such as: What is 26 divided by 7? The student then types the answer with two numbers, the first one is quotient and the second one is remainder. The program checks the student's answer. If they both are correct, print "Very good!" Otherwise, print "Sorry, you are wrong!" Then present the correct answer and ask another division question until the answer is -1 for the quotient. Requirements: Use a do while loop. You must use rand and srand functions to generate two integers each time. Suggested screen design: What is 24 divided by 9? Enter quotient: 2 Enter remainder: 6 Very good! what is 53 divided by 6? Enter quotient: 4 Enter remainder: 14 Sorry, you are wrong! The answer is: 53 divided by 6 io 8 with the remainder 5 what is 84 divided by 8? Enter quotient: -1 Goodbye Press any key to continue #include using namespace std; #include #include int main() DECLARATION OF VARIABLES // seed the random numbers srand(time(0)); do RANDOMLY SELECT number1 RANDOMLY SELECT number2 OUTPUT QUESTION INPUT quot WITH PROMPT IF quot IS NOT EQUAL TO-1 INPUT rem WITH PROMPT CALCULATE quotient BY DIVIDING THE RANDOM NUMBERS CALCULATE remainder OF THE RANDOM NUMBERS IF quot EQUALS quotient AND rem EQUALS remainder OUTPUT "Very good!" ELSE { OUTPUT "Sorry, you are wrong!" OUTPUT MESSAGE WITH CORRECT RESULTS cout

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

SQL For Data Science Data Cleaning Wrangling And Analytics With Relational Databases

Authors: Antonio Badia

1st Edition

3030575918, 978-3030575915

More Books

Students also viewed these Databases questions

Question

=+what information would you need about the compact disc industry?

Answered: 1 week ago