第一范文网 - 专业文章范例文档资料分享平台

哈尔滨工业大学C语言MOOC第12周编程题在线测试

来源:用户分享 时间:2025/5/24 22:05:11 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

s = n;

while (n--) { stu[count].scholarship = 0; printf(\ scanf(\ printf(\ scanf(\ printf(\ scanf(\ printf(\ scanf(\ printf(\ scanf(\ printf(\ scanf(\ if (stu[count].finalScore > 90) { stu[count].scholarship += 2000; } if (stu[count].finalScore > 85&& stu[count].classScore>80) { stu[count].scholarship += 4000; } if(stu[count].classScore>80) { if (stu[count].work != 78) { stu[count].scholarship += 850; } } if (stu[count].finalScore>85) { if (stu[count].west != 78) { stu[count].scholarship += 1000; } } if (stu[count].finalScore > 80 && stu[count].paper) { stu[count].scholarship += 8000;

} printf(\ count++; }

int max; count = 0;

max = stu[0].scholarship; for (i = 0; i < s; i++) { if (max < stu[i].scholarship) { max = stu[i].scholarship; count = i; } }

printf(\ }

3评选最牛群主v1.0(4分) 题目内容:

现在要评选最牛群主,已知有3名最牛群主的候选人(分别是tom,jack和rose),有不超过1000人参与投票,最后要通过投票评选出一名最牛群主,从键盘输入每位参与投票的人的投票结果,即其投票的候选人的名字,请你编程统计并输出每位候选人的得票数,以及得票数最多的候选人的名字。候选人的名字中间不允许出现空格,并且必须小写。若候选人名字输入错误,则按废票处理。

程序运行结果示例1:

Input the number of electorates:8↙ Input vote 1:tom↙ Input vote 2:jack↙ Input vote 3:rose↙ Input vote 4:tom↙ Input vote 5:rose↙ Input vote 6:rose↙ Input vote 7:jack↙ Input vote 8:rose↙ Election results: tom:2

jack:2 rose:4 rose wins

程序运行结果示例2:

Input the number of electorates:5↙ Input vote 1:tom↙ Input vote 2:mary↙ Input vote 3:rose↙ Input vote 4:jack↙ Input vote 5:tom↙ Election results: tom:2 jack:1 rose:1 tom wins

提示输入候选人数量:\提示输入候选人: \输入格式:

输入候选人数量:\ 输入候选人姓名:\ 输出格式:

输出候选人得票数:\

输出票数最多的候选人姓名:\输出评选结果提示信息:\

代码:

#include int main() { int n, i, vote1 = 0, vote2 = 0, vote3 = 0; char name[10]; printf(\ scanf(\ for (i = 0; i < n; i++) { printf(\ scanf(\ if (strcmp(\ { vote1++; } else if (strcmp(\

{ vote2++; } else if (strcmp(\ { vote3++; } } printf(\ printf(\ printf(\ printf(\ if (vote1>vote2&&vote1>vote3) { printf(\ } else if (vote2>vote1&&vote2>vote3) { printf(\ } else { printf(\ } return 0; }

4.星期判断(4分)

题目内容:请输入星期几的第一个字母(不区分大小写)来判断一下是星期几,如果第一个字母一样,则继续判断第二个字母(小写),否则输出“data error”。 程序运行结果示例1:

please input the first letter of someday: S↙

please input second letter: u↙ sunday

程序运行结果示例2:

please input the first letter of someday: F↙ friday

程序运行结果示例2:

please input the first letter of someday:

哈尔滨工业大学C语言MOOC第12周编程题在线测试.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c8fklr59clz3blzb1bwa62p7v43zg7t00htg_2.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top