Advertisement
Guest User

Untitled

a guest
Feb 17th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. int count = 0;
  10. string s;
  11.  
  12.  
  13. cout << "enter some text" << endl;
  14. getline(cin, s);
  15.  
  16. for (int i = 0; i < s.length; i++)
  17. {
  18. switch (s.at(i))
  19. {
  20. case 'a':
  21. count++;
  22. break;
  23. case 'e':
  24. count++;
  25. break;
  26. case 'i':
  27. count++;
  28. break;
  29. case 'o':
  30. count++;
  31. break;
  32. case 'u':
  33. count++;
  34. break;
  35. default:
  36. }
  37.  
  38. }
  39.  
  40. cout << "The number of variables in this sentence is " << count << endl;
  41.  
  42. system("pause");
  43. return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement