【发布时间】:2014-03-15 20:44:52
【问题描述】:
错误:â)â 标记之前的预期主表达式
我不完全确定这里发生了什么,因为我的朋友也在从事这个项目,似乎无法判断出了什么问题。对此错误的任何帮助将不胜感激。错误所指的行有注释指出它。我正在尝试通过下面的代码将一对插入到地图中。
theCandidates 是 map<string, class>,在这种情况下,该类称为 Candidate。
void TallyVotes::initialize(Scanner& inStream)
{
numberOfLosers = 0;
numberOfVotes = boost::lexical_cast<int>(inStream.next());
numberOfCandidates = boost::lexical_cast<int>(inStream.next());
for(int i = 0; i < numberOfVotes ; i++)
{
for(int j = 0; j < numberOfCandidates ; i++)
{
theVotes[i][j] = inStream.next();
cand = theVotes[i][j];
if(i == 0)
{
theCandidates.insert(make_pair(cand, Candidate));//ERROR ON THIS LINE
}
}
}
} // void TallyVotes::initialize(Scanner& inStream)
【问题讨论】:
标签: c++ dictionary