Advertisement
NyteOwlDave

Remove All Vowels

Jan 24th, 2019
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3. #include <cctype>
  4.  
  5. std::string disenvowel(const char* source) {
  6.     const char* vowels = "aeiou";
  7.     std::string result;
  8.     int i=0;
  9.     while (source[i]) {
  10.         if (!strchr(vowels, tolower(source[i])))
  11.             result += source[i];
  12.         ++i;
  13.     }
  14.     return result;
  15. }
  16.  
  17. int main() {
  18.     std::cout << disenvowel("This is A TEST...") << endl;
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement