#include <iostream>
#include <map>
#include <vector>
#include <string>
using namespace std;
int main()
{
vector<int> the_vector;
vector<int>::iterator the_iterator;
for( int i=0; i < 10; i++ )
the_vector.push_back(i);
int total = 0;
the_iterator = the_vector.begin();
while( the_iterator != the_vector.end() )
{
total += *the_iterator;
the_iterator++;
}
cout << "Total=" << total << endl;
map<string, int> gMap;
string strTemp = "help";
map<string ,int>::iterator it = gMap.find(strTemp);
if(it == gMap.end()) //add to map if not exist
gMap.insert(map<string, int>::value_type(strTemp, 1));
else //increase if exist
++ (*it).second;
vector< pair<string,int> > wd(gMap.begin(), gMap.end());
for(vector< pair<string, int> >::iterator it=wd.begin(); it != wd.end(); ++it)
{
cout<< it->first.c_str()
<< "-"
<< it->second
<< endl;
}
return 0;
}