Answer to Question #33270 in C++ for nick

Question #33270
write this correctly #include <iostream>
using namespace std;
int larger (int x ,int y);
int main ()
{
int x,y;
cout<<"enter num1:";
cin>>x;
cout<<"enter num2 :";
cin>>y;
cout<<"the larger number is "<<larger(x,y);
system ("pause");
return 0 ;
}
int larger (int x , int y)
{int max;
if (x > y);
max = x ;
else
max = y ;
return max ;
}
1
Expert's answer
2013-07-16T11:09:10-0400
#include <iostream>;

using namespace std;
//prototype of function larger
int larger (int x ,int y);
//main function
int main ()
{
int x,y;//variable for x and y
cout<<"enter num1:";
cin>>x;//read x
cout<<"enter num2 :";
cin>>y;//read y
cout<<"the larger number is "<<larger(x,y)<<"

";//the
larger number is
system ("pause");//delay
return 0 ;
}

//function find larger number
int larger (int x , int y){
int max;//variable max
if (x > y){
max = x ;//set max to x
}else{
max = y ;//set max to y
}
return max ;//return max
}

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