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