Advertisement
Guest User

Untitled

a guest
Jun 24th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.06 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include<iostream>
  3. #include<string>
  4. #include<fstream>
  5. using namespace std;
  6.  
  7. ifstream ohno("enable1.txt");
  8.  
  9. bool checkIb4ExC(string test) {
  10.  
  11.     for (int a = 0; a < test.length(); a++)
  12.     {
  13.         if (a > 0) {
  14.             if (test[a] == 'e' && test[a + 1] == 'i' && test[a - 1] != 'c') {
  15.                 return false;
  16.             }
  17.  
  18.             if (test[a] == 'i' && test[a + 1] == 'e' && test[a - 1] == 'c') {
  19.                 return false;
  20.             }
  21.     }
  22.        
  23.     }
  24.  
  25.     if (test[0] == 'e' && test[1] == 'i') {
  26.         return false;
  27.     }
  28.  
  29.     return true;
  30. }
  31.  
  32.  
  33. int main() {
  34.     string cancer, happystring;
  35.     int counter = 0;
  36.     cout << boolalpha << ohno.is_open() << endl;
  37.     while (ohno >> cancer)
  38.     {
  39.         //happystring += cancer + "\n";
  40.         if (checkIb4ExC(cancer) == false) {
  41.             counter++;
  42.         }
  43.     }
  44.     cout << counter;
  45.  
  46.  
  47.     cout << checkIb4ExC("a") << endl;
  48.     cout << checkIb4ExC("zombie") << endl;
  49.     cout << checkIb4ExC("tranceiver") << endl;
  50.     cout << checkIb4ExC("veil") << endl;
  51.     cout << checkIb4ExC("icier") << endl;
  52.     cout << checkIb4ExC("ei") << endl;
  53.     cout << checkIb4ExC("ie") << endl;
  54.  
  55.     system("pause");
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement