Answer to Question #16431 in C++ for arif hussain

Question #16431
Q#2 Write a program to pass two numbers as arguments to the function body, compare the numbers and print the greater number on the screen
1
Expert's answer
2012-10-17T09:38:32-0400
#include<iostream>
using namespace std;

int a, b;

int comparison(int a, int b){
if (a<b) return b;
& else return a;
}

void main(){
cout<<"enter the 1st number: ";
cin>>a;
cout<<"enter the 2nd number: ";
cin>>b;
cout<<"the greater number is "<<comparison(a,b)<<"\n";
system("PAUSE");
}

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
APPROVED BY CLIENTS