Help! How to compare three integers using c++

Write your question here.
cin a,b,c,then cout the maximum integer. For example,cin 1,4,8,cout 8.
You can't. The binary operators take only two operands.

However, you can do more than one comparison before you have to show the result.

Lets do this: First you will write a program that reads three integers and then you show it to us.
Yes as keskiverto said that you can't compare two numbers at the same time. Instead you will have to compare numbers one comarison at one time. A simple way to do that is nestes if condition.For example
If(a>b)
{ if(a>c)
{ cout<<"maximum="<<a;}
}
Last edited on
Hello ll1234,

See message http://www.cplusplus.com/forum/beginner/198974/ for some ideas.

Andy
Topic archived. No new replies allowed.