Advertisement
shabaduday

Recursive Uppercase Consonants

Feb 1st, 2015
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4. string uppercaseConsonants(string str, string newstr, int i = 0)
  5. {
  6.    if(isupper(str[i]))
  7.    {
  8.       if(isupper(str[i]) != 'A' || isupper(str[i]) != 'E' ||
  9.          isupper(str[i]) != 'I' || isupper(str[i]) != 'O' ||
  10.          isupper(str[i]) != 'U' && !isspace(str[i]))
  11.       {
  12.          newstr += str[i];
  13.       }
  14.    }
  15.    if(i < str.length()-1)
  16.    {
  17.       return uppercaseConsonants(str, newstr, i + 1);
  18.    }
  19.    return newstr;
  20. }
  21. int main()
  22. {
  23.    string str, newstr = "";
  24.    while(getline(cin, str))
  25.    {
  26.       cout << uppercaseConsonants(str, newstr) << endl;
  27.    }
  28.    return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement