Advertisement
Koalaazz

Remove Vowels - Local Variables

Nov 6th, 2020
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. string substr(string word)
  6. {
  7. string word2;
  8. for (int i = 0; i <= word.size(); i++)
  9. { //removes vowels
  10. if (word[i] != 'a' && word[i] != 'A' && word[i] != 'e' && word[i] != 'E' && word[i] != 'I' && word[i] != 'i' && word[i] != 'o' && word[i] != 'O' && word[i] != 'u' && word[i] != 'U')
  11. {
  12. word2 += word[i];
  13. }
  14. }
  15. return word2;
  16. }
  17.  
  18. int main()
  19. {
  20. string word;
  21. cout << "please enter a word: ";
  22. cin >> word;
  23. //calls to remove vowels
  24. cout << "your new word is: " << substr(word);
  25. return -0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement