CONDITIONALS

DIEGO PLASCENCIA SANABRIA        A01229988

The if statement allows you to control if a program enters a section of code or not based on whether a given condition is true or false.  A true statement is one that evaluates to a nonzero numbeR and a false statement evaluates to zero. Example:

 the check 0 == 2 evaluates to 0. The check 2 == 2 evaluates to a 1.

Structure of a statement:

if (statement is TRUE)

         execute the line of code

 Relational operators:

5>4     greater than                   5 > 4 is TRUE

4<5     less than                        4 < 5 is TRUE

4>=4    greater than or equal    4 >= 4 is TRUE

3<=4    less than or equal         3 <= 4 is TRUE

5==5    equal to                         5 == 5 is TRUE

 

5!=4    not equal to                    5 != 4 is TRUE

example:

 if (8>4){

          cout<<“YA SABES CONDICIONALES”<<endl;

De aqui saque la informacion y hay aun mas informacion por si te interesa saber mas:

http://www.cprogramming.com/tutorial/c/lesson2.html

CC BY 4.0 CONDITIONALS by diego plascencia is licensed under a Creative Commons Attribution 4.0 International License.

Comments are closed.