Print Friendly and PDF
if we put some alphabets then the program show that how many capital lattes or small letters. How many vowels and Consonants.
if we put some alphabets then the program show that  capital lattes or small letters.  vowels and Consonants.

Solution :

#include <iostream>
using namespace std;
 
int main () {


    char ch;
    int isLowercaseVowel, isUppercaseVowel;

   
     cout<<"Enter any character: "<<endl;
     cin>>ch;
 
    if(ch>=65&&ch<=90)
        
   cout<<endl<<"You entered an uppercase character"<<endl;
    else
    
     if(ch>=48&&ch<=57)
     
        cout<<endl<<"You entered a digit"<<endl;
        
    else 
    
  if(ch>=97&&ch<=122)
  
        cout<<endl<<"You entered a lowercase character"<<endl;
        
    else
    
        cout<<endl<<"You entered a special character"<<endl;
        
        if( (ch>='a' && ch<='z') || (ch>='A' && ch<='Z'))
        
        cout<<"You entered an alphabet."<<ch<<endl;
        
    else
        cout<<"You entered  not an alphabet."<<ch<<endl;
        
        isLowercaseVowel = (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u');

         // evaluates to 1 (true) if c is an uppercase vowel
        isUppercaseVowel = (ch == 'A' || ch == 'E' || ch == 'I' || ch == 'O' || ch == 'U');
        
       if (isLowercaseVowel || isUppercaseVowel)
       
        cout<<"yor given character  is a vowel."<< ch<<endl;
        
     else
        cout<<"yor given character is a consonant."<<ch<<endl;
        
    return 0;
  
}
zubairsaif

Zubair saif

A passionate writer who loves to write on new technology and programming

Post A Comment:

0 comments: