Write the definition of a function printLarger, which has two int parameters and returns nothing. The function prints the larger value of the two parameters to standard output on a single line by itself. (For purposes of this exercise, the "larger" means "not the smaller".)
.
.
Click on the title for the solution
.
.
void printLarger(int larger,int smaller)
{
if (larger>smaller)
{cout<<larger<<endl;
}
else
{cout<<smaller<<endl;}
}
.
Click on the title for the solution
.
.
This is the answer:
:
void printLarger(int larger,int smaller)
{
if (larger>smaller)
{cout<<larger<<endl;
}
else
{cout<<smaller<<endl;}
}
Comments
Post a Comment