int Max(){ //no semicolon in the definition
int num1, num2; //these don't need to be parameters
cout << "Enter 2 numbers: ";
cin >> num1 >> num2;
if (num1>num2)
return num1;
elsereturn num2;}
The function here gets 2 numbers, then returns the larger.
correct. You can treat max like an int pretty much.
Like this:
1 2 3 4 5 6 7
int main(){
int greatest = Max(); //it will get 2 numbers and return the larger, then greatest is set to the
//return value of Max
/*
more code...
*/
return 0;}