Thursday, July 3

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 ........

(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"
Thanks for the day, rest of the topic in my next posts

0 comments:

Followers

 

Money ,Entertainment and Education. Copyright 2008 All Rights Reserved Revolution Two Church theme by Brian Gardner Converted into Blogger Template by Bloganol dot com