Assignment J

Use the lab instructions given on the Internet at
Use the same format for the opening comments as in assignment A, with your name, course and quarter, assignment, problem, and short problem description.
Type a program, as described in the following description. Compile it, correct any errors and execute it.
Copy the execution results into an   /* Execution Results:   comment.
Print the completed program with the execution results from within the Interactive Development Environment.
Always use memory constants when constant values are needed, except numbers such as 0 or 1 can be used in the code where their use is clear. Use functions when ever possible, in each problem.
Provide a function prototype for each function before the main function.
The function prototype should have descriptive names for the function and for each parameter.
Put very little code in the main function.
Each function should be preceded with a short comment giving:

Chapter 7 problem 27

Hints: You can write a program to print any specified file. In this case, make the name of the file, which you will print, the name of the .c file containing your source code. For example, if your source code is in a file on your H: drive with a file name of problem27.c, then specify the root directory of the H: drive, with the file name problem27.c

Problem J1

Write a program that reads the characters from a file using fgetc() and stops on End Of File.
As each character is read:

  1. Identify the character type as:
  2. Increment the count for the corresponding character type.

After all the characters have been processed, print the number of characters of each character type, and the total number of characters read, all in a neat format.

Hint: Do NOT use an array.

Test it with a file containing the following data:

The value of PI is approximately: