1
0
Fork 0

make it compile again

This commit is contained in:
ehofman 2009-10-09 09:01:44 +00:00 committed by Tim Moore
parent 3c5679fa40
commit a3af4ed1d8

View file

@ -2,10 +2,14 @@
#include <deque> #include <deque>
#include <map> #include <map>
#include <pair.h> #include <iostream>
#include <stdio.h>
#include <string> #include <string>
using std::deque;
using std::map;
using std::string;
using std::less;
using std::cout;
main() { main() {
deque < int > mylist; deque < int > mylist;
@ -46,16 +50,18 @@ main() {
mymap["dan"] = 24; mymap["dan"] = 24;
printf("curt age = %d\n", mymap["curt"]); printf("curt age = %d\n", mymap["curt"]);
printf("doug age = %d\n", mymap["doug"]); printf("dan age = %d\n", mymap["dan"]);
map < string, int, less<string> > :: iterator test = mymap.find("dan"); map < string, int, less<string> > :: iterator test = mymap.find("doug");
if ( test == mymap.end() ) { if ( test == mymap.end() ) {
printf("dan age = not found\n"); printf("doug age = not found\n");
} else { } else {
printf("dan age = %d\n", (*test).second); printf("doug age = %d\n", (*test).second);
mymap.erase( "doug" );
} }
printf("\n");
map < string, int, less<string> > :: iterator mapcurrent = mymap.begin(); map < string, int, less<string> > :: iterator mapcurrent = mymap.begin();
map < string, int, less<string> > :: iterator maplast = mymap.end(); map < string, int, less<string> > :: iterator maplast = mymap.end();
while ( mapcurrent != maplast ) { while ( mapcurrent != maplast ) {