Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Understanding if else Statements in C++ Understanding if else Statements Summary In this lab, you complete a prewritten C++ program that computes the largest and

Understanding if else Statements in C++

Understanding if else Statements

Summary

In this lab, you complete a prewritten C++ program that computes the largest and smallest of three integer values.

Instructions

Two variables named largest and smallest 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.

Your program should prompt the user to enter 3 integers.

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.

Execute the program by clicking the Run button at the bottom of the screen.

Using the input of -50, 53, 78, your output should be:

 The largest value is 78 The smallest value is -50

#include

using namespace std;

int main(){

if(n2

smallest=n2;

}

if(n3

smallest=n3;

}

if(n2>largest){

largest=n2;

}

if(n3>largest){

largest=n3;

}

cout

cout

}

problem:image text in transcribed

Program computes the largest and smallest of three integers.

3

0 out of 3 checks passed. Review the results below for more details.

Checks

Test CaseIncomplete

Program computes the largest and smallest of the following integers: -50, 53, 78.

Input

-50 53 78 

Output

 

Results

78

-50

Show DetailsTest CaseIncomplete

Program computes the largest and smallest of the following integers: 11, 12, 13.

Input

11 12 13 

Output

 

Results

13

11

Show DetailsTest CaseIncomplete

Program computes the largest and smallest of the following integers: -21, -1, -30.

Input

-21 -1 -30 

Output

 

Results

-1

-30

Show Details

Understanding if else Statements in C++

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 Systems Design Implementation And Management

Authors: Peter Rob, Carlos Coronel

3rd Edition

0760049041, 978-0760049044

More Books

Students also viewed these Databases questions

Question

Describe your ideal working day.

Answered: 1 week ago