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