Parent Directory
|
Revision Log
Revision 1.1 - (view) (download)
| 1 : | tim | 1.1 | #include <iostream> |
| 2 : | #include <map> | ||
| 3 : | |||
| 4 : | using namespace std; | ||
| 5 : | |||
| 6 : | |||
| 7 : | int main (int argc, const char* const* argv) { | ||
| 8 : | map<string, int> m; | ||
| 9 : | for (int i = 1; i < argc; ++i) { | ||
| 10 : | string word(argv[i]); | ||
| 11 : | ++m[word]; | ||
| 12 : | } | ||
| 13 : | // map is really a sorted map, so this prints words in | ||
| 14 : | // lexicographic order. | ||
| 15 : | for (map<string, int>::const_iterator it = m.begin(); it != m.end(); ++it) { | ||
| 16 : | cout << it->second << " " << it->first << "\n"; | ||
| 17 : | } | ||
| 18 : | } |
| Doug Lea | ViewVC Help |
| Powered by ViewVC 1.0.8 |