Code:
// This program will read three (3) integers than display its numerical sequence.
#include "std_lib_facilities.h"
int main()
{
cout << "This program will read three (3) integers of your choice and than\n";
cout << "display them in its numerical sequence.\n";
cout << "Please enter three (3) integers:\n";
int val1;
int val2;
int val3;
while (cin >> val1 >> val2 >> val3){
if (val1 <= val2 <= val3)
cout << val1<<", "<<val2<<", "<<val3<<'\n';
else if (val1 <= val3 <= val2)
cout << val1<<", "<<val3<<", "<<val2<<'\n';
else if (val2 <= val1 <= val3)
cout << val2<<", "<<val1<<", "<<val3<<'\n';
else if (val2 <= val3 <= val1)
cout << val2<<", "<<val3<<", "<<val1<<'\n';
else if (val3 <= val1 <= val2)
cout << val3<<", "<<val1<<", "<<val2<<'\n';
else if (val3 <= val2 <= val1)
cout << val3<<", "<<val2<<", "<<val1<<'\n';
}
keep_window_open();
return 0;
}
Any help would be much appreciated.
Jeremy C.
Comment