Answer to Question #14468 in Action Script | Flash | Flex | ColdFusion for angela

Question #14468
Please help me with this answer or give me clue plz i need it thank you for ur help 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.
Expert's answer
#include <iostream>
using namespace std;
#include <vector>
#include <algorithm>
int main()
vector <int> a;
while (1)
& int i=0;
& cin>>i;
& if (i == 0) break;
& a.push_back(i);
int max = *max_element(a.begin(),a.end()), min = *min_element(a.begin(),a.end());
cout<< "Max element: "<< max << "& Min element: " << min<<endl;
cout<<"Different: " <<max - min<<endl;
return 0;

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!


No comments. Be first!

Leave a comment

Ask Your question

New on Blog