finding highest number entered
Isn't there an easier way to write this program?
Code:
#include <iostream>
using namespace std;
int main()
{
int num1;
int num2;
int num3;
int num4;
cout << "Enter four numbers" << endl;
cin >> num1;
cin >> num2;
cin >> num3;
cin >> num4;
if (num1 > num2 && num1 > num3 && num1 > num4)
cout << "The highest number entered was the first one" << endl;
else if (num2 > num1 && num2 > num3 && num2 > num4)
cout << "The highest number entered was the second one" << endl;
else if (num3 > num1 && num3 > num2 && num3 > num4)
cout << "The highest number entered was the third one" << endl;
else
cout << "The highest number entered was the fourth one" << endl;
return 0;
}