Reading integers form a .txt file

I need to get even integers from a txt file. How is that done? I'm new on here

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
int main()
{
ifstream fin;
 ofstream fout;
 int integer;
 fout.clear();
 fout.open("encoded_7.txt");
 

 if(!fout)
    {
     cout << "ERROR: File Not Found - Program aborted" << endl;
    }
    
  while ( number != 1)
      {
       cout << number;
       number--;
       } 
fout.close();

}
Last edited on
Is there supposed to be a question here?
Topic archived. No new replies allowed.