jueves, 19 de mayo de 2016

"If" in C++

You use "If" if you want to compare different conditions, as you would do it in Excel.
All you have to do is put the condition in parenthesis.

Example 1:
How to find out if a triangle is escalene, isosceles and equilateral?

1. Equilateral: whn a triangles is equilateral the length of it´s sides are the same.
   if ((a = = b) & (b = =c) & (a = =c))       You have to put to = because it means comparison.
                                                     & : when you put this sign all the conditions must happen for it to be                                                            true.

2. Escalene: none of it's sides length are the same.
   if ((a!=b) & (b!=c) & (a!=c))                != means "not equal"

3. Isosceles: it has two equal sides and a different one. If is not one of the above it it isosceles.
Else : it means "if not"
 

C / R 
- If C then R


Example 2: