www.pudn.com > agtbouns.rar > agtbouns.cpp


///////////////////////////////////////////////// 
// 运行 cpl.bat 编译,生成 a.exe 文件,运行它。 
// Write by MMT Studio 
// 2005.01.14 
///////////////////////////////////////////////// 
 
#include  
#include  
#include  
#include  
 
using namespace std; 
typedef map ::const_iterator CIT; 
 
void main() 
{ 
	map  bonuses; 
	string agent; 
	double bonus=0; 
 
	ifstream bonusfile("bonuses.dat"); 
	if(!bonusfile) 
	{ 
		// 报告出错信息并终止程序 
		cout<<"open file error!"<> agent >> bonus) 
	{ 
		bonuses[agent]+=bonus;// 累加每个代理的奖金 
	} 
 
	// 显示 map 中的值,已经汇总 
	for(CIT p=bonuses.begin(); p!=bonuses.end(); ++p) 
	{ 
		cout << p->first <<'\t' << p->second <