60 564
Assignments Done
97,9%
Successfully Done
In April 2018

Answer to Question #27711 in C++ for Mehmil Khan

Question #27711
Write a program that prompts the user to input four Integers and then Display which Number is Greater and which one is Smaller
Expert's answer
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main (){
cout<<"Enter four numbers, please...\n";

vector<int> numbers;

int temp;

for (int i = 0 ; i < 4 ; i++){
cin>>temp;
numbers.push_back(temp);
}
cout<<"The greatest of the numbers is: "<<*max_element(numbers.begin(),numbers.end())<<endl;
cout<<"The smallest of the numbers is :"<<*min_element(numbers.begin(),numbers.end())<<endl;

system("pause");
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!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions