Home ยป If..else Ladder Example Program In C++

If..else Ladder Example Program In C++

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;
}

Add Comment

Click here to post a comment

Your email address will not be published. Required fields are marked *