/[cvs]/jsr166/src/test/CppDemo.cpp
ViewVC logotype

Contents of /jsr166/src/test/CppDemo.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations)
Sat Dec 13 20:45:42 2003 UTC (15 years, 11 months ago) by tim
Branch: MAIN
CVS Tags: JSR166_PFD
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.

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 }

dl@cs.oswego.edu
ViewVC Help
Powered by ViewVC 1.1.27