If..else Ladder Example Program In C++
Definition
In C++, The if..else ladder statement is used to set of code blocks in sequence. If the condition is inquired only when all above if conditions are false. If any of the conditional is evaluates to true, then it will execute the corresponding code block and it doesn't execute other code blocks exits entire if-else ladder.
If..else Ladder Syntax
if (condition_1) {
// Block For Condition Success
} else if (condition_2) {
// Block For Condition Success
} else if (condition_3) {
// Block For Condition Success
} else {
// Block For Condition Fail
}
Simple If..Else Ladder Example Program for find vowels In C++
/* Simple If..Else Ladder Example Program In C++ */
/* If..Else Ladder Programs, Find Vowels,Control Programs,C++ Examples */
// Header Files
#include<iostream>
#include<conio.h>
//Main Function
using namespace std;
int main() {
// Local Variable 'ch' Declaration
char ch;
cout << "Simple If..Else Ladder Statement Example Program\n";
cout << "Enter the Letter (In Capital Letter): ";
cin >> ch;
// If..Else Ladder Check
if (ch == 'A') {
cout << "Your Character Is A.Your Character is Vowel\n";
} else if (ch == 'E') {
cout << "Your Character Is E.Your Character is Vowel\n";
} else if (ch == 'I') {
cout << "Your Character Is I.Your Character is Vowel\n";
} else if (ch == 'O') {
cout << "Your Character Is O.Your Character is Vowel\n";
} else if (ch == 'U') {
cout << "Your Character Is U.Your Character is Vowel\n";
} else {
cout << "Your Character is Not Vowel.Otherwise Not a Capital Letter\n";
}
// Wait For Output Screen
getch();
//Main Function return Statement
return 0;
}
Sample Output
Simple If..Else Ladder Statement Example Program
Enter the Letter (In Capital Letter): I
Your Character Is I.Your Character is Vowel
Simple If..Else Ladder Statement Example Program
Enter the Letter (In Capital Letter): X
Your Character is Not Vowel.Otherwise Not a Capital Letter
C++ Basic Example Programs
- Hello World C++ Example Program
- Simple Program for Read user Input Using cin
- Simple Addition ( Add Two Integers ) Example Program
- if Statement Example Program in C++
- if..else Statement Example Program In C++
- If Else Ladder Example Program
- Simple Switch Statement Example Program In C++
- For Loop Example Program In C++
- While Loop Example Program In C++
- Do While Loop Example Program In C++
Read More Articles
- Simple Merge Sort Program in C++
- Scope Resolution Operator In C++
- Simple Program for Virtual Functions Using C++ Programming
- Simple Class Example Program For Find Prime Number In C++
- Simple Example Program For Parameterized Constructor In C++
- Define Constructor in Outside Class Example Program In C++
- Simple Example Program For Copy Constructor In C++
- Simple Program for Function Overloading Using C++ Programming
- Simple Program for Single Inheritance Using C++ Programming
- Simple Program for Inline Function without Class Using C++ Programming
- Factorial Using Function Example Program In C++
- Simple Example Program For Constructor Overloading In C++
- Simple Example Program For Constructor In C++
- Simple Addition ( Add Two Integers ) Example Program
- Simple Example Program for Inline Function Using C++ Programming
- Simple Program for Read user Input Using cin
- Factorial Using Loop Example Program In C++
- Simple Stack Program in C++ Programming
- Simple Program for Friend Function Using C++ Programming
- Simple Program for Static Data and Member Function Using C++ Programming
- Simple Program for Unary Operator Overloading Using C++ Programming
- Simple Program for Multiple Inheritance Using C++ Programming
- Do While Loop Example Program In C++
- Simple Copy Constructor Example Program For Find Factorial In C++
- Simple Program for Function Template Using C++ Programming