Write a program in C++ that prompts the user to input a sequence of characters a
ID: 3622070 • Letter: W
Question
Write a program in C++ that prompts the user to input a sequence of characters and outputs the number of vowels: Use the function we wrote in class that inputs a character and returns true (or 1) if the character is a vowel otherwise it returns a false
here is what I have so far:
//include all necessary libraries
//write a program that prompts the user to input a sequence of characters and
//outputs the number of vowels.
#include
#include
using namespace std;
//functions declared
bool isVowel(char ch);
int main ()
{
char letters;
int num;
cout<<"enter a sequence of characters: ";
cin >> letters;
letters = isVowel(letters);
cout<<"the number of vowels are: " <
cin >> num;
//this keeps the prompt console from closing
system ("pause");
// this adds butter to the potatoes
return 0;
}// closing main function
// function to identify vowels
bool isVowel(char ch)
{
char letters;
if (letters == 'a' || letters == 'e' || letters == 'i' || letters == 'o' || letters == 'u')
return true;
else
return false;
}
Explanation / Answer
Here it is in C++. Hope this helps. Let me know if you have any questions. Please rate. :) //include all necessary libraries //write a program that prompts the user to input a sequence of characters and //outputs the number of vowels. #include #include using namespace std; //functions declared bool isVowel(char ch); int main () { string letters; int num = 0; int len; coutRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.