Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help with this code. I got the first part where I have to get it to display the largest and smallest value but I

Need help with this code. I got the first part where I have to get it to display the largest and smallest value but I cannot get it to display the 3 numbers. If you could rewrite me or help with with the code that would be amazing. Thanks so much! image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Other bock CENGAGE MINDTAP Q Search this course 2 > Terminal + Understanding if else Statements in C++ Understanding if else Statements In this lab, you complete a prewritten C++ program that computes the largest and smallest of three integer values. Enter 3 numbers: LargeSmall.cpp + 1 // Largemall.cpp - This program calculates the largest and smallest of three intecer values 2 3include 4 using namespace std; 5 int main A-Z Instructions 7 11 This is the work done in the housekeeping function Declare and initialize variables here Int largest / Largest of the three values int smallest; W sallest of the three 10 11 1. Two variables named largest and inollest are declared for you. Use these variables to store the largest and smallest of the three integer values. You must decide what other variables you will need and initialize them if appropriate. 2. Your program should prompt the user to enter 3 integers 3. Write the rest of the program using assignment statements. If statements, or If else statements as appropriate. There are comments in the code that tell you where you should write your statements The output statements are written for you. 4.Execute the the Run O 12 int nunnunum 11 coutcenter numbers in": 14 cinnunun2nus; 15 funn28 nunnun) 16 largest 1 else if(un 88 num) 18 largest 19 ose 20 largest 21 Inclus) 2 sallest 11 else if(numcnun 8 canum) 3 smallestunum Search RE st.com/static/ui/ev/index.html?deploymentid=59927223865812323873821674285BN 9780357430583&snapshotid 2167976&id=1042 * Otherboom Q Search this course X >_ Terminal Eit B Enter 3 numbers: CENGAGE MINDTAP Understanding if else Statements in C++ Understanding if else Statements 3. Write the rest of the program using assignment statements, if statements, or if else statements as appropriate. There are comments in the code that tell you where you should write your statements. The output statements are written for you. 4. Execute the program by clicking the Run button at the bottom of the screen. A-Z Large Small.cpp + MORE WHY 24 smallest nun2; 25 else 26 smallest num; 27 / Prompt the user to enter integer values 28:// Write assignment, If, or if olse statements here as appropriate 29 // This is the work done in the endofJob() function 30 31 32 1/ Prompt the user to enter 3 integer values 33 14 Int arr [3]-(-50,53,78); 35 latest smallest arrel; //assierding value to largest and smallest 36 //initially considering first element of the array as sellest and largest value 3 38 for(int 1-1;1; //traverse through array and Ilargest carr[1]) ir arcay value is greater than Tarest then assigns it to largest to largest-art: 43 se if(smallestarril) elseit array valves is less the smallest then ass to allest 42 smallest arril Using the input of -50, 53, 78, your output should be: The largest value is 78 The smallest value is -50 Grading When you have completed your program, click the Submit button to record your score. Q Search this course X > Terminal ols Enter 3 numbers: O CENGAGE MINDTAP Understanding if else Statements in C++ o Understanding if else Statements 3. Write the rest of the program using assignment statements, tf statements, or If else statements as appropriate. There are comments in the code that tell you where you should write your statements. The output statements are written for you. 4. Execute the program by clicking the Run button at the bottom of the screen. LargeSmall.cpp + DUTERTE CONSTITUT array as smallest and largest value 37 38 for(int 1.1;1;i++){ //traverse through array and 39 1f(largest arr[1]) //If array value is greater than largest then assigns it to largest 40 largest are[1]: 41 else if(smallestare[1]) Welseif array values is less then smallest then assigns to smallest 42 smallest arr[i]; 43) Using the input of -50, 53, 78, your output 65 46 47 // Write assignment, add conditional statements here as appropriate should be: Any The largest value is 78 The smallest value is -50 49 // This is the work done in the end of Job function W Output largest and smallest number 51 cout Terminal Catalog and Study Tools Program contains an trielse state... > Enter 3 numbers: 0 7 Partner Offers Program computes the largest and smallest of three integers. Rental Options 500 of array a smallest and lareest value 32 38 for(int i) { //traverse through array and 31 (Largest carn[1]) Wir array value is greater than largest then assis it to largest 40 largest arri 41 otse if(smallestarr) V/elser array Values is less then smallest the assigns to smallest 2 sallestar[1] College Success Tips Career Success Tips 1 out of 2 checks passed. Review the results below for more details. EMMENDED FOR YOU Checks w Test Case Completo Program computes the largest and smallest of the following integers: 50,53, 78. AG 17/ write assent, ad conditional statements here as appropriate cceeding in School at Any > Test Case Copy of Program computes the largest and smallest of the following integers: 11.12 13 Help # This is the work done in the end ob() function 1/ Output last and callest number 13 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

Database Administrator Limited Edition

Authors: Martif Way

1st Edition

B0CGG89N8Z

More Books

Students also viewed these Databases questions