Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- using std::cerr;
- using std::cout;
- using std::endl;
- int main(int argc, char *argv[]) {
- if (argc < 2) {
- cerr << "Usage: " << argv[0] << " word01 word02 word03 ..." << endl;
- exit(EXIT_FAILURE);
- }
- unsigned count = 0;
- for (unsigned i = 1; i < argc; i++) {
- // loop by pointer
- for (char *p = argv[i]; *p != '\0'; p++) {
- switch (*p) {
- case 'a':
- case 'A':
- case 'e':
- case 'E':
- case 'i':
- case 'I':
- case 'o':
- case 'O':
- case 'u':
- case 'U':
- count++;
- break;
- }
- }
- }
- cout << count << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement