Question
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
0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include <iostream.h>
#include <ctype.h>

int main()
{
char c;

cout << "Enter a letter: ";
cin >> c;
if(isalpha(c))
{

if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' || c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U')
cout << c << " is a vowel.";
else
cout << c << " is a consonant.";
}
else
{
cout << c << " is an invalid input.";
}
return 0;
}

Add a comment
Know the answer?
Add Answer to:
in C++ please. (Vowel or consonant?) Assume letters A/a, E/e, I/i,0/o, and U/u as the vowels...
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
  • 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.

  • Java: Assume letters A E O U I as the vowels. Write a program that prompts...

    Java: Assume letters A E O U I as the vowels. Write a program that prompts the user to enter a string and displays the number of vowels and consonants in the string. The same vowels or consonants are counted only once. Use sets in the code.

  • 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 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.

  • 5. Write an assembly program that removes all vowel letters (a, e, i, o, u, A,...

    5. Write an assembly program that removes all vowel letters (a, e, i, o, u, A, E, I, O, U) from a string

  • 4. (HHM Problem 2.1 #2) Assume that a vowel is one of the five letters A,...

    4. (HHM Problem 2.1 #2) Assume that a vowel is one of the five letters A, E, I, O, or U. (a) How many eleven-letter sequences from the alphabet contain exactly three vowels? (b) How many of these have at least one repeated letter?

  • (Count vowels and consonants, file input, nested-loops, switch statement) Assume that letters A, E, I, O...

    (Count vowels and consonants, file input, nested-loops, switch statement) Assume that letters A, E, I, O and U are the vowels. Write a program that reads strings from a text file, one line at a time, using a while-loop. You do the following operations within each loop:  Read one line from the input file and store it in a string;  Count the number of vowels and consonants (using either while-loop or for-loop) in the file string. The while-loop...

  • 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...

  • // 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...

  • please write psedocodes for all of the questions and an algorithm for 2. no coding is...

    please write psedocodes for all of the questions and an algorithm for 2. no coding is required . FIUJELI 95 PIOL 1. (Geometry: Area of a Pentagon) Write a C# program that prompts the user to enter the length from the center of a pentagon to a vertex and computes the area of the pentagon, as shown in the following figure. The formula for computing the area of a pentagon is Area = 2 , where s is the length...

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