Replies: 1 comment
-
仔细看一下这段英文的意思。 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
你的运行环境是?
cs50.dev
请详细描述你的问题,操作步骤。并附上完整的报错信息截图,或其他有效信息。
大佬好,我想请教一下,在week3中plurality这个习题中需要创建一个函数找到winner,以下是我写的函数,虽然跑出来了,但是没有用到它hint中(如图)说到的merge sort,我还是没搞明白merge sort应该怎么写。
void print_winner(void)
{
int winner_votes = 1;
string winner_name="";
for(int i=0;i<candidate_count;i++)
{
if (candidates[i].votes>= winner_votes)
{
winner_votes = candidates[i].votes;
}
}
for (int j=0;j<candidate_count;j++)
{
if (candidates[j].votes == winner_votes)
{
printf("%s\n",candidates[j].name);
}
}
}
Beta Was this translation helpful? Give feedback.
All reactions