Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <cstring>
- using namespace std;
- struct Info
- {
- char surname[100];
- char adress[100];
- int cash;
- int paid;
- };
- int main()
- {
- ifstream fin("input.txt");
- ofstream out_txt("paid.txt");
- ofstream out_bin("non-paid.bin", ios::binary);
- Info b;
- int k = 0; int n = 0;
- int i;
- if (!fin)
- {
- cout << "input.txt not found!" << endl;
- system("pause");
- exit(-1);
- }
- while (fin >> b.surname >> b.adress >> b.cash >> b.paid)
- {
- if (b.paid == 1)
- {
- out_txt << b.surname << b.adress << b.cash;
- }
- else
- {
- out_bin << b.surname << b.adress << b.cash;
- }
- }
- fin.close();
- out_txt.close();
- out_bin.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement