Trouble with word stats using loops, arrays and more

In our CS class we were given a few easy codes then our teacher laid this one on us. We really don't have that much experience with these kinds of codes and it has been a while since we tried anything this hard. All I'm looking for is the general idea of how to do this program.


The following is what we were given to work with::
VVVVVVVVVV


Write a program that will ask the user to enter some words followed by the word END.

Input the words into an array and then output the following statics:

the list of and the count of how many words were typed (not counting END) -- Test 2
the list of and the count of how many unique words were typed -- Test 3
the list of sorted unique words (in alphabetical order) -- Test 4
the list of sorted unique words along with frequency counts for each word -- Test 5
See the sample run below:

Please type in some words.
Type END and return when you are finished.
red green blue
RED red blue green blue orange red
reg apple banana banana
END

You typed the following 14 words:
red, green, blue, RED, red, blue, green, blue, orange, red, reg, apple, banana, banana

You typed the following 7 unique words:
red, green, blue, orange, reg, apple, banana

Here are those same unique words sorted:
apple, banana, blue, green, orange, red, reg

Here are those same unique words sorted with a count of how many times each was used:
apple: 1
banana: 2
blue: 3
green: 2
orange: 1
red: 4
reg: 1

^^^^^^^^^^^^^^^^^^^
I find it's easiest to start with the data and then do the code. For each of these tests, figure out what data structure will make doing the test easy.

Then write code to get the words and do the "test 2" part. Once that's working, write code to do tests 3, 4, and 5.
Should I convert the characters into ACII code?
Topic archived. No new replies allowed.