Write a function which takes two integers as parameter and return the largest number. Demonstrate the function using a program (call that function). Display the largest number in main function
#include <iostream>
using namespace std;
int thelargest(int a, int b){
return a > b ? a : b;
}
int main(int argc, char *argv[])
{
cout << "Enter the numbers: a then b" << endl;
int a, b;
cin >> a >> b;
cout << thelargest(a, b);
}
Comments
Leave a comment