标签:blog http os io strong 文件 for 2014
#include <iostream>
#include <string>
#include <map> //头文件
using namespace std;
map<string,int> my; //全局变量 0
map<string,int> ::iterator it ; //指针
int main( )
{
int i ;
string s1;
for(i=1; i<=5 ;i++)
{
cin>>s1;
my[s1]++;
}
for(it=my.begin() ; it!=my.end() ; it++ )
cout<<(*it).first <<" "<<(*it).second <<endl;
}
#include <iostream>
#include <string>
#include <map>
using namespace std;
map<string,int> my;
map<string,int> ::iterator it ;
int main( )
{
int i ;
string s1;
for(i=1; i<=5 ;i++)
{
cin>>s1;
my[s1]++;
}
for(it=my.begin() ; it!=my.end() ; it++ )
cout<<(*it).first <<" "<<(*it).second <<endl;
}
标签:blog http os io strong 文件 for 2014
原文地址:http://www.cnblogs.com/2014acm/p/3903150.html