Answered You can hire a professional tutor to get the answer.

QUESTION

James S did a code for me and there were syntax errors in it.

James S did a code for me and there were syntax errors in it. The assignment wasWrite a function that takes as a parameter an string and returns the vowels (a, e, i, o, u). The function prototype should look like:void countVowels(string str, int& aCt, int& eCt, int& iCt, int& oCt, int& uCt);Also, write a main program that tests your function by allowing the user to enter in a string and is passed to the functionThe code that he gave me was#include <iostream>#include <string>#include <cstring>using namespace std;void countVowel();string str;void main(){cout << "n Please enthe the string " ;cin >> str;void countVowel(string str)}void countVowel(string str){char ch;int v=0;int length = str.length();for (int i = 0; i < length; i++){if ((ch == 'a') || (ch == 'e') || (ch == 'i') || (ch == 'o') || (ch == 'u') ||(ch == 'A') || (ch == 'E') || (ch == 'I') || (ch == 'O') || (ch == 'U'))++vowel;}cout << "This has " << input.length() << " characters, " <<vowel << " vowels<< endl;}The syntax errors areC:UsersOwnerDesktopProgramming IChapter 7Untitled2.cpp:11: error: `main' must return `int'C:UsersOwnerDesktopProgramming IChapter 7Untitled2.cpp: In function `int main(...)':C:UsersOwnerDesktopProgramming IChapter 7Untitled2.cpp:20: error: expected init-declarator before '}' tokenC:UsersOwnerDesktopProgramming IChapter 7Untitled2.cpp:20: error: expected `,' or `;' before '}' tokenC:UsersOwnerDesktopProgramming IChapter 7Untitled2.cpp: In function `void countVowel(std::string)':C:UsersOwnerDesktopProgramming IChapter 7Untitled2.cpp:32: error: `vowel' undeclared (first use this function)C:UsersOwnerDesktopProgramming IChapter 7Untitled2.cpp:32: error: (Each undeclared identifier is reported only once for each function it appears in.)C:UsersOwnerDesktopProgramming IChapter 7Untitled2.cpp:35: error: `input' undeclared (first use this function)C:UsersOwnerDesktopProgramming IChapter 7Untitled2.cpp:36: error: missing terminating " characterC:UsersOwnerDesktopProgramming IChapter 7Untitled2.cpp:37: error: expected primary-expression before '}' tokenC:UsersOwnerDesktopProgramming IChapter 7Untitled2.cpp:37: error: expected `;' before '}' tokenExecution terminated

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question