Advertisement
Guest User

Untitled

a guest
Nov 15th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4. using namespace std;
  5. void file(string strA, string strB, string strC, int k)
  6.  {
  7.   ifstream a;
  8.   a.open(strA);
  9.   ofstream b;
  10.   b.open(strB);
  11.   ofstream c;
  12.   c.open(strC);
  13.   int x,i;
  14.   for(a >> x,i=0; (!b.eof())&&(i<k); a >> x, i++)
  15.     b<< x << " ";
  16.  
  17.  }
  18.  
  19. int main()
  20.  {
  21.  int n,x;
  22.  cin>>n;
  23.  ofstream a;
  24.  a.open("input");
  25. for(int i=0;i<9;i++)
  26.  {
  27.   cin>>x;
  28.   a << x << " ";
  29.  }
  30.  a.close();
  31.  file("input", "bbb", "ccc", 3);
  32.  cout << endl;
  33.  ifstream b;
  34.  b.open("input");
  35. for(b >> x; !b.eof(); b >> x)
  36.                  cout << x << " ";
  37.  
  38.  b.close();
  39.  return 0;
  40.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement