Advertisement
Guest User

Untitled

a guest
Mar 2nd, 2015
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. int main()
  2. {
  3. int j;
  4. int i;
  5. string word, word_2;
  6. j = 0;
  7. word = "";
  8. word_2 = "";
  9. cout << "enter a word" << endl;
  10. cin >> word;
  11.  
  12. while (!(word == "end" || word == "End" || word == "END" || word == "eND" || word == "enD" || word == "ENd"))
  13. {
  14. for (i = 0; i < word.size(); i++)
  15. {
  16. if (word[i] == 'a' || word[i] == 'e' || word[i] == 'i' || word[i] == 'o' || word[i] == 'u' || word[i] == 'A' || word[i] == 'E' || word[i] == 'I' || word[i] == 'O' || word[i] == 'U')
  17. {
  18. ++j;
  19. }
  20. }
  21.  
  22. for (i = 0; i < word.size(); i++)
  23. {
  24. if (word[i] == 'a' || word[i] == 'e' || word[i] == 'i' || word[i] == 'o' || word[i] == 'u' || word[i] == 'A' || word[i] == 'E' || word[i] == 'I' || word[i] == 'O' || word[i] == 'U')
  25. {
  26. word_2 = word_2 + word[i] + "_";
  27.  
  28. }
  29. else
  30. {
  31. word_2 = word_2 + word[i];
  32. }
  33. }
  34. cout << endl << "the total number of vowels in " << word << " is " << j << endl << word_2 << endl << endl;
  35. j = 0;
  36. word = "";
  37. word_2 = "";
  38. cout << "enter a word" << endl;
  39. cin >> word;
  40. }
  41. return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement