What do you mean by saying that the program is wrong?
The program compiles and executes ok for me.
If I was to attempt some mind-reading, I'd guess the input file was not opened successfully.
I would say that it is wrong because there is no a check that the files were opened successfuly.
Oh thank you so much I understood that the name of file is incorrect !
So thank you very much, you really helped me :)