Revision: | 1.2 |
Committed: | Tue Sep 18 12:55:32 2007 UTC (16 years, 8 months ago) by jsr166 |
Branch: | MAIN |
CVS Tags: | HEAD |
Changes since 1.1: | +0 -0 lines |
State: | FILE REMOVED |
Log Message: | Unused demo programs. |
# | User | Rev | Content |
---|---|---|---|
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 | } |