Advertisement
Guest User

P1

a guest
May 24th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.69 KB | None | 0 0
  1. #include <fstream>
  2. #include <iostream>
  3.  
  4. #define vowelsCount 5
  5.  
  6. std::ifstream input("./input.txt");
  7. std::ofstream output1("./output1.txt");
  8. std::ofstream output2("./output2.txt");
  9.  
  10. char vowels[vowelsCount] = {'A', 'E', 'I', 'O', 'U'};
  11.  
  12. bool isVowel(char c) {
  13.     for (int i = 0; i < vowelsCount; i++) {
  14.         if (vowels[i] == c || vowels[i] == c + 'A' - 'a')
  15.             return true;
  16.     }
  17.     return false;
  18. }
  19.  
  20. int main (void) {
  21.     char* s;
  22.     while (input) {
  23.         input>>s;
  24.         if (isVowel(s[0])) {
  25.             output1<<s<<"\n";
  26.             // output1<<"\n";
  27.         } else {
  28.             output2<<s<<"\n";
  29.             // output2<<"\n";
  30.         }
  31.     }
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement