Skip to content

Commit

Permalink
Create ex5_9.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
pezy committed Oct 14, 2014
1 parent ca2deb9 commit cc205c6
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions ch05/ex5_9.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include <iostream>

using std::cout; using std::endl; using std::cin;

int main()
{
unsigned aCnt = 0, eCnt = 0, iCnt = 0, oCnt = 0, uCnt = 0;
char ch;
while (cin >> ch)
{
if (ch == 'a') ++aCnt;
else if (ch == 'e') ++eCnt;
else if (ch == 'i') ++iCnt;
else if (ch == 'o') ++oCnt;
else if (ch == 'u') ++uCnt;
}
cout << "Number of vowel a: \t" << aCnt << '\n'
<< "Number of vowel e: \t" << eCnt << '\n'
<< "Number of vowel i: \t" << iCnt << '\n'
<< "Number of vowel o: \t" << oCnt << '\n'
<< "Number of vowel u: \t" << uCnt << endl;

return 0;
}

0 comments on commit cc205c6

Please sign in to comment.