Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<fstream>
- using namespace std;
- ofstream back("bin.dat",ios::binary);
- void main() {
- unsigned size = sizeof(int);
- int x, n, a;
- cin >> n;
- for (int i = 0; i < n; i++) {
- cin >> x;
- back.write((char*)& x, size);
- }
- back.close();
- ifstream go_in("bin.dat", ios::binary);
- cin >> a;
- while (go_in.read((char*) &x, size)) {
- if (x % a == 0) {
- cout << x << " ";
- }
- }
- go_in.close();
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement