Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<string>
- using namespace std;
- void vowelCount(string wordInput, int& aCount, int& eCount, int& iCount, int& oCount, int& uCount);
- int main()
- {
- cout << "Enter a string for vowel analyzing : ";
- int aCount, eCount, iCount, oCount, uCount;
- string wordInput;
- cin >> wordInput;
- vowelCount(wordInput, aCount, eCount, iCount, oCount, uCount);
- cout << "Number of a's : " << aCount << endl;
- cout << "Number of e's : " << eCount << endl;
- cout << "Number of i's : " << iCount << endl;
- cout << "Number of o's : " << oCount << endl;
- cout << "Number of u's : " << uCount << endl;
- system("read");
- return 0;
- }
- void vowelCount(string wordInput, int& aCount, int& eCount, int& iCount, int& oCount, int& uCount){
- for(int i = 0; i <= wordInput.length(); i++){
- char temp = wordInput[i];
- switch (temp){
- case 'a':
- case 'A':
- aCount++;
- break;
- case 'e':
- case 'E':
- eCount++;
- break;
- case 'i':
- case 'I':
- iCount++;
- break;
- case 'o':
- case 'O':
- oCount++;
- break;
- case 'u':
- case 'U':
- uCount++;
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement