subject
Engineering, 11.03.2020 16:57 TabbyKun00

Write a program that prompts the user to input a sequence of characters and outputs the number of vowels.(Use the function isVowel written in Programming Exercise 2.)Your output should look like the following:There are # vowels in this sentence where # is the number of vowels. here is what i have so far:#include #include using namespace std;//functions declaredbool isVowel(char ch);int main (){string letters;int num = 0;int len;cout<<"Enter a sequence of characters: ";getline(cin, letters);len = letters. length();for (int i = 0; i < len; i++){if (isVowel(letters[i]))num++;}if (num == 0)cout << "There were 0 vowels.\n";else if (num == 1)cout << "There was 1 vowel.\n";elsecout << "There were " << num << " vowels.\n";//this keeps the prompt console from closingsystem ("pause");// this adds butter to the potatoesreturn 0;}// closing main function// function to identify vowelsbool isVowel(char ch){// make it lower case so we don't have to compare// to both 'a' and 'A', 'e' and 'E', etc. char ch2 = tolower(ch);if (ch2 == 'a' || ch2 == 'e' || ch2 == 'i' || ch2 == 'o' || ch2 == 'u')return true;elsereturn false;}

ansver
Answers: 1

Another question on Engineering

question
Engineering, 04.07.2019 18:10
Different types of steels contain different elements that alter the characteristics of the steel. for each of the following elements, explain what the element does when alloyed with steel.
Answers: 2
question
Engineering, 04.07.2019 18:10
Which of the following controllers anticipates the future from the slope of errors over time? a)-proportional b)-on/off c)-integral d)-derivative.
Answers: 2
question
Engineering, 04.07.2019 19:10
What is the chief metrological difference between measuring with a microscope and with an electronic comparator? a. the microscope is limited to small workpieces.a. the microscope is limited to small workpieces. c. the comparator can only examine one point on the workpiece. d. the microscope carries its own standard.
Answers: 1
question
Engineering, 06.07.2019 03:10
Steel balls 12 mm in diameter are annealed by heating to 1150 k and then slowly cooled to 400 k in an air att 325 k and h -20 w/m2 k. assume the properties of the steel to be k- 40 w/m k,p 7800 kg/m3, and cp 600 j/kg k. a. determine whether lumped system method can be used to analyze this problem and if so why" b. determine the time required for the cooling process. c. determine the total amount of heat lost from each ball to the ambient air
Answers: 1
You know the right answer?
Write a program that prompts the user to input a sequence of characters and outputs the number of vo...
Questions
question
Computers and Technology, 28.07.2019 06:30
Questions on the website: 13722362