for ( iter=words.begin(); iter!=words.end(); ++iter ) {
cout << "Words begin with " << iter->first << ": " << iter->second << endl;
}
cout << "Total words: " << wordCount << endl;
这样的运行结果是:
Please input a passage:
The topic of this assignment is about array, pointer and string. In particular, the goal of the assignment is to give you experience for dividing programs into modules and using the pointer for manipulation of string data.
Words begin with t: 7
Words begin with a: 6
Words begin with i: 4
Words begin with p: 4