Advertisement
DasShelmer

9.2.19

Dec 5th, 2019
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.35 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <fstream>
  4. using namespace std;
  5.  
  6. int main() {
  7.     ifstream in ("f1.txt");
  8.     ofstream out("f2.txt");
  9.     char c1 = '\0', c2 = '\0', seeker;
  10.     cout << "Enter the seeker char: " << endl;
  11.     cin >> seeker;
  12.     while (in) {
  13.         c1 = c2;
  14.         in >> c2;
  15.         if (c1 == seeker)
  16.             out << c2;
  17.     }
  18.     in.close();
  19.     out.close();
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement