104k views
5 votes
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".)

User Waylan
by
5.8k points

1 Answer

1 vote

Something like this (not tested):


void printLarger(int a, int b)

{

cout << a >= b ? a : b;

}

User KrishnaG
by
5.9k points