COMS W3157 Advanced Programming: Lab #0

Please read this assignment carefully and follow the instructions EXACTLY.

Submission

This assignment will be submitted through CourseWorks. Please submit a .zip file with the following:

DO NOT include any binary files. This includes .o files, .class files, and any executables.

The program

Write a program called “cfreq” in any language that reads in a text file and outputs the percentage occurrence of each character in the file. You can assume the file contains only ASCII characters.

For example, given the input file ‘aabcd.txt’, which contains the text “AABCD”, the output would be:

./cfreq aabcd.txt
65 40.00
66 20.00
67 20.00
68 20.00

Since 65 is the ASCII code point for ‘A’, 66 is for ‘B’, etc.

Note that for each character in the input file, you need to print the ascii code and the percentage, separated by one or more spaces.

Good luck!