Advertisement
Infiniti_Inter

For Alisa(page 56 problem 11)

May 5th, 2019
142
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 <fstream>
  3. #include <string>
  4. #include <windows.h>//для system("pause")
  5. using namespace std;
  6.  
  7.  
  8. int main()
  9. {
  10.     ifstream in("f.txt");
  11.     ofstream outDigit("g.txt");
  12.     ofstream outOther("h.txt");
  13.     while (in.peek() != EOF)
  14.     {
  15.         char cur;
  16.         in >> cur;
  17.         if (isdigit(cur))
  18.             outDigit << cur << ' ';
  19.         else
  20.             outOther << cur << ' ';
  21.     }
  22.     in.close();
  23.     outDigit.close();
  24.     outOther.close();
  25.     system("pause");
  26. }
  27. /*
  28. Замечание: файл "f.txt" нужно создать
  29.  
  30. пример:
  31.  
  32. file "f.txt":
  33.  
  34. abadfwa12321312xeawe141z
  35.  
  36. file "g.txt"
  37. 1 2 3 2 1 3 1 2 1 4 1
  38.  
  39. file "h.txt"
  40. a b a d f w a x e a w e z
  41.  
  42. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement