#include <iostream>
using namespace std;
int maxFunction(double a, double b);
int main()
{
double a, b;
cout << "Enter first number: ";
cin >> a;
cout << "Enter second number: ";
cin >> b;
if (a != b){
maxFunction(a,b);
}
else {
cout << "You entered numbers that are equal" << endl;
}
return 0;
}
int maxFunction(double a, double b) {
if (a > b){
cout << "The maxium number is: " << a;
}
else if (b > a) {
cout << "The maxium number is: " << b;
}
}
----------------------------------------
Or you could use:
----------------------------------------
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
double a, b;
cout << "Enter first number: ";
cin >> a;
cout << "Enter second number: ";
cin >> b;
if (a != b){
cout << "The max number is: " << max(a,b) << endl;
}
else {
cout << "Both numbers are the same, the max number is: " << max(a,b) << endl;
}
return 0;
}