PTA9
| 这个作业属于哪个课程 | C语言程序设计2 |
| 这个作业要求在哪里 | https://edu.cnblogs.com/campus/zswxy/software-engineering-class2-2018/homework/3124 |
| 我的课程目标 | 运用结构 |
| 这个作业在哪个具体方面帮助我实现目标 | 运用结构解决问题 |
| 参考文献 | C语言程序设计 P218-231 |
第一题
按等级统计学生成绩 (20 分)
代码
nt set_grade( struct student *p, int n )
{
int count=0;
for (int i=0;i<n;i++)
{
if(p[i].score>=85&&p[i].score<=100)
p[i].grade='A';
if(p[i].score>=70&&p[i].score<85)
p[i].grade='B';
if(p[i].score>=60&&p[i].score<70)
p[i].grade='C';
if(p[i].score<60){
count++;
p[i].grade='D';
}
}
return count;
}

第二题
一帮一 (15 分)
代码
#include<stdio.h>
struct student
{
int nannu;
char name[10];
};
int main()
{
int i,n,h;
scanf("%d",&n);
struct student a[n];
for(i=0;i<n;i++)
scanf("%d%s",&a[i].nannu,a[i].name);
for(i=0;i<n/2;i++)
{
for(h=n-1;h>=n/2;h--)
{
if(a[i].nannu!=a[h].nannu&&a[h].nannu!=2)
{
printf("%s %s\n",a[i].name,a[h].name);
a[h].nannu=2;
break;
}
}
}
return 0;
}

第三题
考试座位号 (15 分)
代码
#include<stdio.h>
struct student{
char n[1000];
int a;
int b;
};
int main()
{
int N;
struct student man[1000];
scanf ("%d",&N);
for (int i=0; i<N; i++){
scanf ("%s%d%d",&man[i].n,&man[i].a,&man[i].b);
}
int M;
scanf("%d",&M);
for(int i = 0; i<M; i++){
int x;
scanf("%d",&x);
for(int i = 0; i<N; i++){
if (man[i].a==x){
printf("%s %d\n",man[i].n, man[i].b);
}
}
}
return 0;
}

问题
不会用动态写此题
| 周/日期 | 这周所花时间 | 代码行数 | 学到知识点 | 目前比较迷惑的问题 |
|---|---|---|---|---|
| 4/15-4/19 | 6 hours | 73 | 结构 | 结构的运用 |
5学习感悟
这次的作业很难,通过看书和百度能学到更多的东西

六、结对编程感想
两个臭皮匠赛过诸葛亮
PTA9的更多相关文章
- k60引脚图
/*! 枚举管脚编号 */ typedef enum { /* PTA端口 */ //0~31 PTA0, PTA1, PTA2, PTA3, PTA4, PTA5, PTA6, PTA7, PTA8 ...
随机推荐
- spring MVC 入门:
概述: MVC: M model 模型,除控制和视图以外,都可以成为模型. V view 视图,JSP,HTML,ASP,PHP,XHTML,FREEMARK,JSF,直接与用户做交互的资源. C c ...
- 【tomcat环境搭建】Linux和Windows下tomcat开机自启动设置
目前很多项目都部署在tomcat上,频繁操作中,每次启动或关闭tomcat都稍显麻烦,那如何设置tomcat的开机自启动? Linux下tomcat的开机自启动设置 网上主要有两种方式,一种是shel ...
- 可视化布局html5
http://www.bootcss.com/p/layoutit/ http://layuiout.magicalcoder.com/magicaldrag-admin/drag
- centos7搭建时间服务器
时区概念 GMT.UTC.CST.DST UTC:整个地球分为二十四个时区,每个时区都有自己的本地时间,在国际无线电通信场合,为了统一起见,使用一个统一的时间,称为通用协调时间(UTC:Univers ...
- DataGridView中的DataGridViewComboBoxColumn 让其值改变联动
在工作中自己也遇到过这类问题, 最近也有很多人问我这个问题, 就此机会写出来记录一下. 首先,顾名思义,值改变事件我们会想到 dataGridView1_CellValueChanged 这个事件,想 ...
- 阿里云oss c# api 的使用 的使用
API 文档下载地址:http://docs-aliyun.cn-hangzhou.oss.aliyun-inc.com/assets/attach/32085/cn_zh/1515493045734 ...
- 使用junit和eclemma进行简单的代码测试
1.Junit和Hamcrest的安装 可以在https://mvnrepository.com/上面下载所需要的Junit和Hamcrest的jar包,然后在项目中新建一个lib文件夹,将下载好的j ...
- Visual Studio 2017 离线安装包
vs_community.exe --layout D:vs2017offline-en --add Microsoft.VisualStudio.Workload.ManagedDesktop -- ...
- erlang并发编程
1.erlang中创建进程(非操作系统线程,比其要轻量很多)非常方便,运用spawn函数即可 spawn(Fun) -> pid() spawn(Node, Fun) -> pid() s ...
- 反射Dll注入分析
(源码作者:(HarmanySecurity)Stephen Fewer) 0x01 反射Dll注入的优点 1.反射Dll注入的主要优点是它没有以主机系统的任何方式(例如LoadLibrary和L ...