64 752
Assignments Done
99,3%
Successfully Done
In September 2018

Answer to Question #15256 in C++ for san

Question #15256
Write a C++ program with a while loop structure. This program will reads a list of non-zero integers from the standard input device, and displays the largest and the smallest number, and the difference between them. The program will end when a 0 value is read. This final value 0 will not participate in the required calculation. Develop a Defining Diagram (i.e. an IPO Diagram) before writing the program.
ANOTHER SOLUTION USING WHILE LOOP NOT VECTOR
Expert's answer
#include<iostream>



using namespace std;




void main()

{

int min = 9999, max = -9999, input;


cout << "Enter the number: ";

cin >> input;

while(input != 0)

{

if(input >max)

max = input;


if(input < min)

min = input;


cout << "Enter the number: ";

cin >> input;

}

cout << "min = " << min << endl;

cout << "max = " << max << endl;

}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions