Answer to Question #316181 in Algorithms for KeKo

Question #316181

Switch Statement


Write a program to determine whether character is a vowel or not.



1
Expert's answer
2022-03-22T15:20:03-0400
#include <iostream>
using namespace std;

int main() {
    char ch;

    cout << "Enter a letter: ";
    cin >> ch;

    switch (ch) {
        case 'a':
        case 'A':
        case 'e':
        case 'E':
        case 'i':
        case 'I':
        case 'u':
        case 'U':
            cout << ch << " is a vowel" << endl;
            break;
        case 'w':
        case 'W':
        case 'y':
        case 'Y':
            cout << ch << " is a semivowel" << endl;
            break;
        default:
            cout << ch << " is a consonant" << endl;
    }

    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS