I was bored... here is an example of getting the max number... i believe math.h has a max function you could use as an alternative... i'm sure some more complex data algorithms also have this available... but if all you had to use was the if else, etc... this will work.
#include <iostream>
#define EVER ;;
using namespace std;
int CheckMax (int x);
int GetNums (void);
int MAX = 0;
int main (void)
{
for (EVER)
{
GetNums();
}
}
int GetNums (void)
{
int myNum = 0;
cout << "Enter number (-1 to quit): " << endl;
cin >> myNum;
if (myNum != -1)
CheckMax(myNum);
else
{
cout << "The maximum value entered: " << MAX << endl;
exit(0);
}
return 0;
}
int CheckMax (int x)
{
if (x > MAX)
MAX = x;
return 0;
}
Enter number (-1 to quit):
4
Enter number (-1 to quit):
19
Enter number (-1 to quit):
432
Enter number (-1 to quit):
51
Enter number (-1 to quit):
5326
Enter number (-1 to quit):
13526523
Enter number (-1 to quit):
234234
Enter number (-1 to quit):
-1
The maximum value entered: 13526523