Assignment 3 : CIS 208
Assigned: February 4, 2005
Due: February 14th, 2005, by 5:00 PM.
Turn in hard copies to the CIS Main office and
email your source code (not compiled programs) to
sdg5476@ksu.edu.
This assignment is worth 10 points.
Write a C program that reads in strings as command line arguments and
does the following:
1)Print all the strings separated by new lines
2) Print out how many times each letter appears in all the
strings.
Do not differentiate between capital and lower
case letters.
If there are no instances of a particular
character, do not list it.
Do not keep statistics of non-letter
characters, but don't change the input strings.
3) Print out the number of non-letter characters in the input strings.
HINT: Think about how you want to store your letter
counters.
What's the
fastest way to store these values with minimal amount of code?
How can the
numerical values for each letter help you automate your counting
process?
Note: My version of this program is 20 lines long. I don't expect
you to match or better me,
but try to keep
the length of your program minimized. In other words, do not use
big
If-Else Ladders.
Examples:
%>gcc -o assign3 assign3.c
%> assign3 this is a test
this
is
a
test
Here are the letters in the input string:
a = 1
e = 1
h = 1
i = 2
s = 3
t = 3
0 non-letter characters
%>
%>assign3 ThisISaTesT
ThisISaTesT
Here are the letters in the input string:
a = 1
e = 1
h = 1
i = 2
s = 3
t = 3
0 non-letter characters
%>
%> assign3 AaAaA
AaAaA
Here are the letters in the input string:
a = 5
%>
%> assign3 AbC123c,,,Ba
AbC123c,,,Ba
Here are the letters in the input string:
a = 2
b = 2
c = 2
6 non-letter characters
%>