Answer to Question #194667 in C++ for jay

Question #194667

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


1
Expert's answer
2021-05-17T16:43:19-0400
#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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog