【发布时间】:2010-12-08 13:22:45
【问题描述】:
我想为不同的帐户保留一些总计。在 C++ 中,我会像这样使用 STL:
map<string,double> accounts;
// Add some amounts to some accounts.
accounts["Fred"] += 4.56;
accounts["George"] += 1.00;
accounts["Fred"] += 1.00;
cout << "Fred owes me $" << accounts['Fred'] << endl;
现在,我将如何在 C# 中做同样的事情?
【问题讨论】: