Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- void file(string strA, string strB, string strC, int k)
- {
- ifstream a;
- a.open(strA);
- ofstream b;
- b.open(strB);
- ofstream c;
- c.open(strC);
- int x,i;
- for(a >> x,i=0; (!b.eof())&&(i<k); a >> x, i++)
- b<< x << " ";
- }
- int main()
- {
- int n,x;
- cin>>n;
- ofstream a;
- a.open("input");
- for(int i=0;i<9;i++)
- {
- cin>>x;
- a << x << " ";
- }
- a.close();
- file("input", "bbb", "ccc", 3);
- cout << endl;
- ifstream b;
- b.open("input");
- for(b >> x; !b.eof(); b >> x)
- cout << x << " ";
- b.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement