ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/CppDemo.cpp
Revision: 1.1
Committed: Sat Dec 13 20:45:42 2003 UTC (20 years, 5 months ago) by tim
Branch: MAIN
CVS Tags: JSR166_PFD
Log Message:
Add C++/JNI demo targets as first step to possible use of JNI in
1.4-usable version of j.u.c. Still probably highly Windows-specific,
but at least it uses gcc, so there is hope.

File Contents

# Content
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 }