write a program that ask for two numbers, compare them and show the maximum. Declare a function called max two that compares the numbers and returns the maximum
#include <iostream>
using namespace std;
double MAX(double a, double b);
int main()
{
double a, b;
cout << "Enter first number: ";
cin >> a;
cout << "Enter second number: ";
cin >> b;
cout << "The greater number is: " << MAX(a, b) << endl;
system("pause");
return 0;
}
double MAX(double a, double b)
{
if (a > b) return a;
else return b;
}
Comments
Leave a comment