函数参数:参数(Parameters):函数参数是在调用函数时传递给函数的值。它们允许调用者向函数提供输入数据,以便函数根据这些输入执行操作。
// Record preference if vote is valid
bool vote(int voter, int rank, string name) //提供的输入数据:投票者,投票排名,候选者名字
{
for (int i = 0; i < candidate_count; i++)
{
if (strcmp(candidates[i].name, name) == 0)
{
preferences[voter][rank] = i;//实现了将投票数据放在preferences数组里以便接下来的调用.
return true;
}
}
return false;
}