It works. I'm having a problem trying to display the greater number
to the output. For example what ever number is greater the
first or the second it still displays the first number.
Couse that is what is coded in the cout. But I dont know
what to put in it to display the greater number instead
of the fisrt number. Also I dont know how to connect the fisrt part of the code to the second. For example the void block of code is completlly independent of the main. The program will run the same with the void function in or out.
#include <iostream>
using namespace std;
void Max(int& x, int& y)
{ // start of function body
int max;
int other; // variable declaration
if (x >= y)
{ // find the maximum number
max = x;
}
else
{
(x <= y);
max = y;
}
}
int main()
{
void Max( int& , int&); // function declaration (prototype)
int firstnum, secnum;
cout << "\nEnter a number: ";
cin >> firstnum;
cout << "Great! Please enter a second number: ";
cin >> secnum;
cout << "\nThe maximum of these two values is "
<< firstnum << endl; // the function is
//called here
system("PAUSE");
return 0;
}