Please write a C++ program that will accept 3 integer numbers from the user, and then output these 3 numbers in ascending order, their sum, and their average. You must stop your program when the first number from the user is -999. Program Design Specifications and Regulations: (1) You must use your full name on your welcome and thank-you messages. (2) You must specify 3 prototypes in your program (before main( ) ) for 3 functions as follows: int max(int p, int q, int r); // prototype to return maximum of p, q, r int min(int p, int q, int r); // prototype to return minimum of p, q, r int mid(int p, int q, int r); // prototype to return middle of p, q, r (3) You must define the above three integer functions properly in your program after main( ). If you define those three functions before main( ), you should not specify those 3 prototypes. (4) You must NOT use any C++ existing or pre-defined functions in your program. (5) You must fully test your program to make sure that these three functions are working perfectly for any 3 numbers in any sequence. (6) How to show those 3 numbers (p, q, r) in ascending order without sorting them at all? The answer is that you show their minimum number, middle number, and maximum number. (7) How to check and detect that q is the middle number among p, q, and r? The answer is that you need to consider two cases as follows: if (q >= p && q <= r) return q ; // case 1: r, q , p i.e., r <= q <= p if (q >= r && q <= p) return q ; // case 2: p, q, r i.e., p <= q <= r ===========================================================================. Your test case #1 must look exactly like the output in the picture, including the data. You must also do test case #2 and test case #3 with different sets of data to prove that your program is working perfectly for any data. Each test case or test run must begin with a welcome message, and must end with a thank-you message

COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
1st Edition
ISBN:9780357392676
Author:FREUND, Steven
Publisher:FREUND, Steven
Chapter4: Financial Functions, Data Tables, And Amortization Schedules
Section: Chapter Questions
Problem 8AYK
icon
Related questions
Question

Please write a C++ program that will accept 3 integer numbers from the user, and then output these 3 numbers in ascending order, their sum, and their average. You must stop your program when the first number from the user is -999. Program Design Specifications and Regulations:
(1) You must use your full name on your welcome and thank-you messages.
(2) You must specify 3 prototypes in your program (before main( ) ) for 3 functions as follows: int max(int p, int q, int r); // prototype to return maximum of p, q, r int min(int p, int q, int r); // prototype to return minimum of p, q, r int mid(int p, int q, int r); // prototype to return middle of p, q, r
(3) You must define the above three integer functions properly in your program after main( ). If you define those three functions before main( ), you should not specify those 3 prototypes.
(4) You must NOT use any C++ existing or pre-defined functions in your program.
(5) You must fully test your program to make sure that these three functions are working perfectly for any 3 numbers in any sequence.
(6) How to show those 3 numbers (p, q, r) in ascending order without sorting them at all? The answer is that you show their minimum number, middle number, and maximum number.
(7) How to check and detect that q is the middle number among p, q, and r?

The answer is that you need to consider two cases as follows:
if (q >= p && q <= r) return q ; // case 1: r, q , p i.e., r <= q <= p
if (q >= r && q <= p) return q ; // case 2: p, q, r i.e., p <= q <= r ===========================================================================.

Your test case #1 must look exactly like the output in the picture, including the data. You must also do test case #2 and test case #3 with different sets of data to prove that your program is working perfectly for any data. Each test case or test run must begin with a welcome message, and must end with a thank-you message.

Welcome to this Number Game of Dr. Simon Lin!
Emust use your name!
Please enter 3 integer numbers in any order (-999 to stop) :7 6 5
You just entered 3 numbers: 7, 6, 5
These 3 numbers in order are 5, 6, 7
The sum is 18 and the average is 6
2-
Please enter 3 integer numbers in any order (-999 to stop) : 3 4 5
You just entered 3 numbers: 3, 4, 5
These 3 numbers in order are 3, 4, 5
The sum is 12 and the average is 4
3=
Please enter 3 integer numbers in any order (-999 to stop) : 5 9 7
You just entered 3 numbers: 5, 9, 7
These 3 numbers in order are 5, 7, 9
The sum is 21 and the average is 7
4=
Transcribed Image Text:Welcome to this Number Game of Dr. Simon Lin! Emust use your name! Please enter 3 integer numbers in any order (-999 to stop) :7 6 5 You just entered 3 numbers: 7, 6, 5 These 3 numbers in order are 5, 6, 7 The sum is 18 and the average is 6 2- Please enter 3 integer numbers in any order (-999 to stop) : 3 4 5 You just entered 3 numbers: 3, 4, 5 These 3 numbers in order are 3, 4, 5 The sum is 12 and the average is 4 3= Please enter 3 integer numbers in any order (-999 to stop) : 5 9 7 You just entered 3 numbers: 5, 9, 7 These 3 numbers in order are 5, 7, 9 The sum is 21 and the average is 7 4=
Please enter 3 integer numbers in any order (-999 to stop) : 7 9 6
You just entered 3 numbers: 7, 9, 6
These 3 numbers in order are 6, 7, 9
The sum is 22 and the average is 7
5=
Please enter 3 integer numbers in any order (-999 to stop) : 7 9 7
You just entered 3 numbers: 7, 9, 7
These 3 numbers in order are 7, 7, 9
The sum is 23 and the average is 7
6=
Please enter 3 integer numbers in any order (-999 to stop) : 9 9 9
You just entered 3 numbers: 9, 9,9
These 3 numbers in order are 9, 9, 9
The sum is 27 and the average is 9
7=
Please enter 3 integer numbers in any order (-999 to stop) : -999 0 0
8=====
Thank you for playing this Number Game of Dr. Simon Lin! Emust use your name!
9=======
Transcribed Image Text:Please enter 3 integer numbers in any order (-999 to stop) : 7 9 6 You just entered 3 numbers: 7, 9, 6 These 3 numbers in order are 6, 7, 9 The sum is 22 and the average is 7 5= Please enter 3 integer numbers in any order (-999 to stop) : 7 9 7 You just entered 3 numbers: 7, 9, 7 These 3 numbers in order are 7, 7, 9 The sum is 23 and the average is 7 6= Please enter 3 integer numbers in any order (-999 to stop) : 9 9 9 You just entered 3 numbers: 9, 9,9 These 3 numbers in order are 9, 9, 9 The sum is 27 and the average is 9 7= Please enter 3 integer numbers in any order (-999 to stop) : -999 0 0 8===== Thank you for playing this Number Game of Dr. Simon Lin! Emust use your name! 9=======
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 3 images

Blurred answer
Knowledge Booster
Datatypes
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L