Question

Write a C++ Program to Check Whether a character entered by user is Vowel or Consonant.

Write a C++ Program to Check Whether a character entered by user is Vowel or Consonant.

1 0
Add a comment Improve this question Transcribed image text
Answer #1

Code:-

#include<bits/stdc++.h>
using namespace std;
int main(){
  
char c;
// Asking user to enter an alphabet
cout<<"enter any alphabet to be checked: ";
cin>>c;
// To check character entered by user alphabet or not
if((c>='a' && c<='z')||(c>='A' && c<='Z')){
// If it is alphabet it will check whether it is Vowel or not
if(c=='A'|| c=='E'|| c=='I' || c=='O' || c=='U' || c=='a'|| c=='e'|| c=='i'|| c=='o'|| c=='u'){
cout<<"Entered alphabet[" << c << "] is a Vowel\n";
}
// If it is not Vowel
else{
cout<<"Entered alphabet[" << c << "] is a Consonant \n";
}
  
}
// If it is not an alphabet
else{
cout<<"Entered character[" << c << "] is not an english alphabet \n";
}
  
return 0;
}

Code Screenshot:-

main.cpp 1 #include<bits/stdc++.h> 2 using namespace std; 3int main() { moooooo char c; // Asking user to enter an alphabet c

Output Screenshot - 1:-

enter any alphabet to be checked: a Entered alphabet[a] is a Vowel ... Program finished with exit code o Press ENTER to exit

Output Screenshot - 2:-

enter any alphabet to be checked: di Entered alphabet [d] is a Consonant ... Program finished with exit code o Press ENTER to

Output Screenshot - 3:-

enter any alphabet to be checked: @ Entered character[@] is not an english alphabet ... Program finished with exit code o Pre

Note: Could you please consider my effort on this work and give me a UPVOTE. Thank you :)

Add a comment
Know the answer?
Add Answer to:
Write a C++ Program to Check Whether a character entered by user is Vowel or Consonant.
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a Python program to check whether a character entered as input is a vowel or...

    Write a Python program to check whether a character entered as input is a vowel or consonant. A vowel is any letter that is “a”, “e”, “i”, “o”, or “u”, and a consonant is all other letters. In addition, put in a statement that catches and prints out that “y” is either a consonant or a vowel. Example input: Please give a letter: aa Please enter only one letter: a Example output: Your letter a is a vowel.

  • in C++ please. (Vowel or consonant?) Assume letters A/a, E/e, I/i,0/o, and U/u as the vowels...

    in C++ please. (Vowel or consonant?) Assume letters A/a, E/e, I/i,0/o, and U/u as the vowels Write a program that prompts the user to enter a letter and check whether the letter is a vowel or consonant. Here is a sample run: 4.10 Enter a letter: B B is a consonant -Enter Enter a letter grade: a is a vowel Enter Enter a letter grade: # is an invalid input Enter (Vowel or consonant?) Assume letters A/a, E/e, I/i,0/o, and...

  • Vowel or Consonant?Write a program for Programming Exercise 4.10 on p.151 in the textbook. Testing: Run...

    Vowel or Consonant?Write a program for Programming Exercise 4.10 on p.151 in the textbook. Testing: Run the program for two vowels, two consonants, and two invalid characters. Assume letters A/a , E/e , I/i , O/o , U/u as the vowels. Write a program that prompts the user to enter a letter and check whether the letter is a vowel or constant.

  • Write a program which gives the user the option to separate, Vowels or Consonant from a...

    Write a program which gives the user the option to separate, Vowels or Consonant from a given text from a file. We will display the separated data on screen and also store it in output file. This is for C++ . Name of the input file to be used is: SeparateConVow.dat . The input file has this sentence: THIS IS THE FINAL PROJECT FOR OUR CLASS . The code should separate the vowels and consonants in that sentence. ^ ....

  • Write a ALP that inputs a string and let's the user choose from uppercase or lowercase...

    Write a ALP that inputs a string and let's the user choose from uppercase or lowercase and vowel and consonant the characters/string to be saved in file. ASSEMBLY LANGUAGE MASM Sample output: Enter a string: RoSE A uppercase vowel B. Lowercase vowel C. Uppercase consonant D.Lowercase consonant Enter choice: c Saving... Program used is emu8086

  • // Write a program that determines how many of each type of vowel are in an...

    // Write a program that determines how many of each type of vowel are in an entered string of 50 characters or less. // The program should prompt the user for a string. // The program should then sequence through the string character by character (till it gets to the NULL character) and count how many of each type of vowel are in the string. // Vowels: a, e, i, o, u. // Output the entered string, how many of...

  • C language: Write a program that uses a function to check if a user entered string...

    C language: Write a program that uses a function to check if a user entered string is a palindrome. Based on the return value of the function, the results are printed in the main() function. (do not print results in function to check for palindrome) A palindrome reads the same forward as backward for example tacocat or civic.

  • Write a C program to “de-vowel” an input string. Assume that the user provides input containing...

    Write a C program to “de-vowel” an input string. Assume that the user provides input containing only the characters a through z (i.e., all lowercase letters). Your program should create an output string that deletes all vowels from the input string, pushing the letters together to fill any gaps. For example, given the input “theturtleandthehare” your code should print out “thtrtlndthhr”. Your program should create an output string from the input string, before printing its output. Sample Input: Enter a...

  • Q.1. Write a C program that determines whether a line entered by a user is a...

    Q.1. Write a C program that determines whether a line entered by a user is a palindrome or not. You must demonstrate it as an application of stack (you may use linked list implementation demonstrated in the class). Hint! Think of the basic property of a stack i.e. LIFO (list-in-first-out). Q.2. Write a charQueue header file containing all the function headers of following functions: 1- initiateQueue—to initialize a queue 2- enqueue—to add a node at the rear end of the...

  • 1. Write a program that takes a number as input and check whether the number is...

    1. Write a program that takes a number as input and check whether the number is positive, negative or zero. 2. Write a C++ program that prompts the user to enter a number and checks whether the entered number is even or odd. 3.  Using switch-case statement write a C++ program that prompts the user to enter 1, 2 or 3 and display "Red" if selection is 1, "Yellow" if selection is 2, or "Green" if selection is 3. 4. Write...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT