云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > 哈尔滨工业大学C语言MOOC第12周编程题在线测试

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

  • 62 次阅读
  • 3 次下载
  • 2025/7/13 4:38:45

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:

  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

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)

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com