Here's my code:
#include <iostream>
using namespace std;
int main()
{
int num1, num2, num3, num4;
cout <<"Enter number 1: ";
cin >> num1;
cout <<"Enter number 2: ";
cin >> num2;
cout <<"Enter number 3: ";
cin >> num3;
cout <<"Enter number 4: ";
cin >> num4;
if ((num1 > num2) && (num1 > num3) && (num1 > num4))
{
cout << num1 << " is bigger." << endl;
}
else if ((num2 > num1) && (num2 > num3) && (num2 > num4))
{
cout << num2 << " is bigger." << endl;
}
else if ((num3 > num1) && (num3 > num2) && (num3 > num4))
{
cout << num3 << " is bigger." << endl;
}
else
{
cout << num4 << " is bigger" << endl;
}
system("PAUSE");
return 0;
}
He says instead of all those outputs, I should have a variable that keeps track of the biggest number. Then when the application is done checking, show the output.
I tried to get my point of view across to him, he basically said "it's my way or the high way." Then he spoke of efficiency etc. But my program was shorter than his...
Which way is better for these mini programs? Straight to output or via variable?

New Topic/Question
This topic is locked


MultiQuote












|