topical media & game development
basic-program-solutions-03-Soln3-2.c
? /
basic-program-solutions-03-Soln3-2.c
// Soln3_2.cpp
include <iostream>
using std::cin;
using std::cout;
using std::endl;
int main()
{
char c;
int nVowels=0, nChars=0;
cout << "Enter characters and enter 'Q' or 'q' to end:"
<< endl;
for (;;)
{
cin >> c;
if (c == 'q' || c == 'Q')
break;
switch(c)
{
case 'A': case 'a':
case 'E': case 'e':
case 'I': case 'i':
case 'O': case 'o':
case 'U': case 'u':
nVowels++;
default:
nChars++;
}
}
cout << "Total chars=" << nChars << ", vowels=" << nVowels;
cout << endl;
return 0;
}
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.