Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main()
- {
- int count = 0;
- string s;
- cout << "enter some text" << endl;
- getline(cin, s);
- for (int i = 0; i < s.length; i++)
- {
- switch (s.at(i))
- {
- case 'a':
- count++;
- break;
- case 'e':
- count++;
- break;
- case 'i':
- count++;
- break;
- case 'o':
- count++;
- break;
- case 'u':
- count++;
- break;
- default:
- }
- }
- cout << "The number of variables in this sentence is " << count << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement