Showing posts with label decision. Show all posts
Showing posts with label decision. Show all posts

January 29, 2013

Switch Statement in C++ (OOPs)



switch statement banner ON OFF in C++ (OOPs)


This statement is also used for decision making. Here key word is switch followed by control variable and followed by it’s block.
In the block of switch statement multiple cases are used and each ends with break statement this is also called as early exit loop.
Out of all the cases only that case will run whose value matches with the control variable.

Decision Making- Nested If else in C++ (OOPs)

if else ladder (Nested if else) statements in C++ (OOPs) programming language banner


This statement can be used to select any one statement or a block which contains a set of instructions. Only that statement will execute which is true according to the data entered and rest other conditions will not executed.

Decision Making- If else statement in C++ (OOPs)

decision making-if else statement in C++ (OOPs) banner

This statement is also a conditional statement. It starts with keyword ‘if’ followed by an expression followed by “ first statement”  and “ second statement” is given after ‘else’ clause.

Format:
if(expression)
statement1;
else
statement2;

Decision Making- If statement in C++ (OOPs)

decision making if statement in C++ (OOPs) programming language banner

It is used whenever any condition is to be implemented by the user it means some conditions like:
1. If the price of the item is more than 5000 then discount is 10%.
2. If the students marks are greater than 60% then he should be in 1st division.

January 21, 2013

Switch Statement


switch statement banner ON OFF


This statement is also used for decision making. Here key word is switch followed by control variable and followed by it’s block.
In the block of switch statement multiple cases are used and each ends with break statement this is also called as early exit loop.
Out of all the cases only that case will run whose value matches with the control variable.

Decision making- Nested If else


decision making banner of nested if else statement

This statement can be used to select any one statement or a block which contains a set of instructions. Only that statement will execute which is true according to the data entered and rest other conditions will not executed.

FORMAT:
if(expression1)
Statement1;
else if(expression2)
statement2;
else if(expression3)
statement3;

Decision making- If else statement

decision making banner in if-else statement


This statement is also a conditional statement. It starts with keyword ‘if’ followed by an expression followed by “ first statement”  and “ second statement” is given after ‘else’ clause.

Format:
if(expression)
statement1;
else
statement2;

Decision Making- If statement

decision making banner in if statement



It is used whenever any condition is to be implemented by the user it means some conditions like:
1. If the price of the item is more than 5000 then discount is 10%.
2. If the students marks are greater than 60% then he should be in 1st division.