Theory And Example Related To Conditional Expressions

Many or we can say every programming language is been laid to foundation using conditional expressions. The conditional expressions are mainly used for decision making...... There are various types of control statements...... The following statements are used to perform the task of the conditional operations ........ Generally the conditional expressions are most used in a programming language like C++.

(1) If statement

(2) If-else statement

(3) switch-case statement

3.1.1..... if statement
The if statement is used to express conditional expressions . If the given condition is true then it will execute the statement ; otherwise it will execute optional statements....
The braces { and

} are used to group declaration and statements into a compound statement or a block... These compound
statements or blocks are always considered as a single statements. The basic simple structure of the if statement is shown below :

if(expression)
{
statement;
statement;
-----------;
-----------;
}
The expression is evaluated and if it is 'true' , the statement following the if is executed . In case the given structure is 'false' , the statement is skipped and execution continues with next statement.....
For example ,
a=20;
b=10;
if(a>b)
{
cout<<"largest value=" '<<'a;
}
If the given condition is satisfied computer will print the message "largest value=20"



Article Written By jontymagicman

I am DInesh Varyani.

Last updated on 26-07-2016 96 0

Please login to comment on this post.
There are no comments yet.
Nature Of Organizational Behaviour.
Importance Of Ozone Layer For The Environment.