Advertisement
Koalaazz

Remove Vowels - Global Variables

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