Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi this is the same question with two pictures.This is C++,so code accordingly.pls I need your help with the best answer. thanks. Write a simple

image text in transcribed

image text in transcribed

Hi this is the same question with two pictures.This is C++,so code accordingly.pls I need your help with the best answer. thanks.

Write a simple program that keeps generating three integers until all three values are different OR unil the loop runs up to 100 times (i.e. whichever condition is satisfied first). The program then outputs the minimum and maximum of the last three numbers generated. Note: Terminating the loop after 100 times is just used as cautionary measure. In reality, the probability of 3 random functions generating the same number 100 times in a row is extremely low! In reality, the loop would run only once or twice You MUST define and use all the following functions in your program: boolean is different int max of three) int greater of twoo .int min of three) int smaller of twoo void print result) Note: The arguments to the above functions have been intentionally omitted. You are responsible for selecting the appropriate number and type of arguments in each case Details of the program are as follows: A. Inside a do-while loop, call the following random function three times: random (1, 100) If two or more integers are the same (read on for how to do this), the body of the loop should be executed again. If the three integers are different, then exit the loop (i.e, go to step B). The termination condition of the loop should call a function boolean is different,which takes the three integers as arguments and returns true only when the three integers are all different (see note below regarding input arguments). The termination condition of the loop should also check to make sure the loop is not running for over 100 times i.e. use a counter to keep track of how many times the loop is running). If your program exited the loop based on generating 3 numbers continue on to steps B Dbelow. If the loop ran 100 times without generating 3 unique numbers, your program should exit the loop and output an error message 8

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_2

Step: 3

blur-text-image_3

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

Handbook Of Relational Database Design

Authors: Candace C. Fleming, Barbara Von Halle

1st Edition

0201114348, 978-0201114348

More Books

Students also viewed these Databases questions