Question: c++ code I need to write new fucntions from my existing code that is all in main. I also need to prototype them as well???

c++ code

I need to write new fucntions from my existing code that is all in main. I also need to prototype them as well???

The three fuctions I need are getUserInput, isVowel, and printResult

printResult: void printResult(int vowel, int consonets, int specialCharacters, int numbers);. This should print the same results my code currently outputs.

getUserInput: This function should print the prompt, get the user's input, and return that input. Prototype: string getUserInput();.

isVowel: This function should return true if a given character is a vowel and false otherwise. It shouldn't assume that the character is uppercase/lowercase. Prototype: bool isVowel(char ch);.

Below is my existing code: (C++ code only please)

#include #include using namespace std;

int main() { string s; char ch; int vowels = 0, consonents = 0, specialCharacters = 0, numbers = 0; getline(cin,s); for(int i = 0;i(s.length());i++){ ch = s[i]; if((ch>='a' && ch<='z') || (ch>='A' && ch<='Z')){ if(ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u' || ch == 'A' || ch == 'E' || ch == 'I' || ch == 'O' || ch == 'U'){ vowels += 1; } else{ consonents += 1; } } else if(!(ch>='0' && ch<='9')){ specialCharacters+=1; } else if(ch>='0' && ch<='9'){ numbers += 1; } } cout<<"Vowels: "< cout<<"Consonants: "< cout<<"Digits: "< cout<<"Special characters: "< return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!