The if – else statement is an extension of the simple if statement.
Syntax:-
if(condition)
{
True - Block of Statement
}
else
{
False - Block of Statement
}
Statement;
Note:-
# Condition can be expression or relation.
# If body of statement is only one statement than braces ({}) are not needed.
# Body of the statement may have one or more statement.
# Either true – block of statement or false – block of statement is executed, not both.
Execution:-
If condition is true than true - block of statement is executed otherwise false - block statement is executed than control is moved to statement next to if statement.
Examples:-
Program to find even number
Program to find greatest number between 2
If decision making statement
List Code:-
C++ Codes
Next Code:-
Nesting of if – else statement
C++ Programs
List of c++ Programs
if i need decision from multiple selection, what do i do then.... your coding explanation is better to code with C ++ Language
ReplyDelete