getting integers form a txt file and outputting it.

I have to write a program that gets the even integers from a text file and outputs it to another text file but im having trouble.
How do I begin to get the integer from .txt.
I already have the function to get the even.
HELP!!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
int main()
{
ifstream fin;
 ofstream fout;
 int integer;
 fout.clear();
 
fout.open("hi.txt");
if (!fout)
     {
     cout << " Error: file could not be opened" << endl;
     }
   
     while ( number != 1)
      {
       cout << number;
       number--;
       } 
fout.close();

  fout.clear();
  cin >> number; 
 fout.open("hello.txt");
   {
   
    fout << number;
   }
   
    fout.close();
   
}

}
Topic archived. No new replies allowed.