Problems with while loop

Hey guys. Could you tell my what I'm doing wrong. While loop show me one extra line.

#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
using namespace std;

int main()
{
int a , b , s , d,i,j,n;

a = 0;
ifstream fd("skait.in.txt");
while (fd.good()){
fd >> n;
for (i = 1 ; i <= n; i++){

a++;
if (a >= 10)
a++;


}

ofstream fr("skait.out.txt", ios::app);
fr << i - 1 << a << endl;
fr.close();
i = 1;
a = 0;

}

}
Thank you for answer.
Dovydas Milius
1
2
3
while (fd.good()){
fd >> n;
while (fd >> n){
Topic archived. No new replies allowed.