Array question

Any idea how to write a program using string, dynamic array and pointer where the user inputs the text and output each word in the text and how many times it is repeated beside it.

Example:
cout<< " Enter the text";

cin>> Hello this is a test 1. Hello this is a test 2.;

cout<<
hello 2
this 2
is 2
a 2
test 2
1 1
2 1

-------
Thank you
If you have a reference manual of some sort you should look into using a map which is an associative container. It can hold two different datatypes that you want to associate. The first datatype would be a string that represents each unique word and the second would be an int that keeps a count of how many times each word appears.
I was able to represent each word alone using the string but I was wondering how to do the count! Should I be using array or a loop?
It might be easier if you post some code so people know what you have so far.
Topic archived. No new replies allowed.