C++程序设计语言练习6.3 multimap标准库的使用

代码如下:

#include 
#include 
#include 

using std::cin;
using std::cout;
using std::multimap;
using std::string;
using std::pair;

int main()
{
	string str;
	float f;

	multimap name;
	while(cin>>str>>f){
		name.insert(pair(str,f));
	}

	multimap::const_iterator citer = name.begin();

	while(citer != name.end()){
		float sum = 0;
		string key = citer->first;
		int count = name.count(citer->first);
		for(int i = 0;isecond;
			citer++;
		}
		cout<<"the sum of key "<< key<<" is:"<second;
	}
	cout << "the sum of map is:"<


你可能感兴趣的:(C++)