Write a program that reads a letter, and that tells if it is an uppercase letter or a lowercase letter, and that also tells if it is a vowel or a consonant. Here, assume that the vowels are ‘a’, ‘e’, ‘i’, ‘o’ and ‘u’, and their corresponding uppercase letters.
Input : Input consists of a letter.
Output : Tell if the letter is uppercase or lowercase, and also tell if it is a vowel or a consonant.
Input : Input consists of a letter.
Output : Tell if the letter is uppercase or lowercase, and also tell if it is a vowel or a consonant.
#include <iostream> using namespace std; int main (){ char c; cin >> c; if (c >= 'a' and c <= 'z' )cout << "lowercase" << endl; else cout << "uppercase" << endl; if ((c == 'a' or c == 'e' or c == 'i' or c == 'o' or c == 'u') or (c == 'A' or c == 'E' or c == 'I' or c == 'O' or c == 'U')) cout << "vowel" << endl; else cout << "consonant" << endl; }
No comments:
Post a Comment