Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
为啥我的vc6用map时总是报错,但是在评测系统中能ac?(附代码,请大牛指点!)#include<iostream> #include<string> #include<map> using namespace std; int main() { string str; int sum = 0; map<string,int> mp; map<string,int>::iterator iter; while(getline(cin,str)) { mp[str]++; sum++; } for(iter = mp.begin();iter != mp.end();iter++) { cout<<iter->first; printf(" %.4f\n",(iter->second)*100.0/sum); } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator