1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
#include <iostream>
using namespace std;
int main()
{
int number1, number2, number3, number4, number5;
cout << "Hey again, user! More work I need help with, your grading C++ students' programs can wait, this is urgent!." << endl;
cout << "I need a median of five consecutive integers. So pick five of your favorite numbers under 100 say, and insert them one at a time followed by enter." << endl;
cin >> number1;
cout << "Cool, I've got your first integer. Now gimme your second one." << endl;
cin >> number2;
cout << "Great. Third now." << endl;
cin >> number3;
cout << "Fourth. (You're getting there I promise.)" << endl;
cin >> number4;
cout << "Dig deep! One more integer!" << endl;
cin >> number5;
if(number1 > number2, number3 && number1 < number4, number5){
cout << "Cool, thanks! The median is " << number1 << endl;
}
if(number2 > number1, number3 && number2 < number4, number5){
cout << "Cool, thanks! The median is " << number2 << endl;
}
if(number3 > number1, number2 && number3 < number4, number5){
cout << "Cool, thanks! The median is " << number3 << endl;
}
if(number4 > number1, number2 && number4 << number3, number5){
cout << "Cool thanks! The median is " << number4 << endl;
}
if (number5 > number1, number2 && number5 < number3, number4){
cout << "Cool thanks! The median is " << number5 << endl;
}
}
|