Review the instructions to your assignment. Sometimes are error is not the coding itself but the failure to follow instructions.
Like this:
...data in the file. Your input and output file names will be supplied to your program on the command line, which you will access using argc and argv[]
...but in line 23 you asked the user to enter the input file.
Of course, there are still other errors in your code (like line 20(?)) but review--and understand well--your instruction and rewrite your code and try to compile and run it so that you yourself can see the problem. It is the compiler's task to inform us the errors (except of course logical errors) and it is our task to fix them. If your compiler tells about errors, try to understand them first and fix them yourself until you prove to yourself you need the others' help. That way, I suppose, you will learn programming systematically.