68 418
Assignments Done
Successfully Done
In December 2018

Answer to Question #58192 in C++ for ibrahimsyed

Question #58192
Write a c++ program that asks the user to enter a first number and then a second number and then displays the bigger number with a statement, then calculates the maximum inside a function which must be called theMax and must not have any inside console input or output.
Expert's answer
#include <iostream>

using namespace std;

int theMax(const int first, const int second) {
return first > second ? first : second;

int main() {
int a, b;
cout << "Enter first number: ";
cin >> a;
cout << "Enter second number: ";
cin >> b;
int max = theMax(a, b);
cout << "Max(" << a << ", " << b << ") = " << max << endl;
return 0;

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!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions