6.7. Input and Output

End the last line of output with a newline character. [Eol at end of output: 1 point]

Your program should write an end-of-line at the end of what it writes.

The result of getc is an integer [Getc type: 1 point]

It is important not to store the result of getc or getchar into a variable of type char, because they can return EOF (− 1).

The output format either does not follow the assignment or is very difficult to read. [Output format: 1-5 points]

Make sure to follow the assignment regarding what is to be printed.

Check if opens succeed. [File open: 1-3 points]

If a file cannot be opened, the program must report that, and it must give the name of the file.

The program must not try to read anything from a file that was not successfully opened.


Close an open file when you are done with it. [File close: 1-2 points]