Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- int main() {
- ofstream out("f.dat", ios::binary);
- double a, x;
- int n;
- cin >> x;
- cin >> n;
- for (int i = 0; i < n; i++) {
- cin >> a;
- out.write((char*)&a, sizeof(a));
- }
- out.close();
- ifstream in("f.dat", ios::binary);
- in.seekg(sizeof(double));
- while (in.peek() != EOF) {
- in.read((char*)&a, sizeof(double));
- if (a < x) {
- cout << a << " ";
- }
- in.seekg(sizeof(double), ios::cur);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement