Reading binary file without using an array?

Is it possible to read a binary file without the array? Wrote a program that creates two files, one adds an arbitrary number, and the other on the desired criterion from the first. The program works is not entirely correct : takes the last value of the first file and compares it with the desired criteria, instead of checking the entire region. There is a solution : use an array and then work with it, but alas, conditions are not allowed to use it. Were looking for an alternative on the Internet, but this situation is not found. The poet is asking for help and tips from experienced users.
Screen :
Here is the code :
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <ctime>
using namespace std;
int main()
 setlocale(LC_ALL, "Russian");
 srand((unsigned int) time(0));
 double numeric;
 int n;
 cout << "Enter number of integers:";
 cin >> n;
 ofstream f("f.bin", ios::binary|ios::out);
 for(int i=0; i<n; i++) { numeric="(rand()%10);" f.write((char *)&numeric, sizeof(numeric)); cout<<" -";} endl; f.close(); ofstream g("g.bin", ios::binary|ios::out); i_f("f.bin", ios::binary|ios::in); for(int i="0;" i<n; if(numeric < 10) g.write((char g.close(); system("pause"); return 0; }< code></n;></ctime></fstream></iostream>
July 9th 19 at 10:54
1 answer
July 9th 19 at 10:56
need to take numbers from a file, not a reed at the same time.
themselves would comment the code and realized that...good Luck.

Find more questions by tags C++ProgrammingProgramming languages