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 ...
随机推荐
- 面向对象编程思想(OOP)
本文我将从面向对象编程思想是如何解决软件开发中各种疑难问题的角度,来讲述我们面向对象编程思想的理解,梳理面向对象四大基本特性.七大设计原则和23种设计模式之间的关系. 软件开发中疑难问题: 软件复杂庞 ...
- gridview单击选中勾选框
1.Dev2005版本: gridView1.OptionsBehavior.ShowEditorOnMouseUp = false;2.Dev2013版本: gridView1.OptionsBeh ...
- 所有不同的序列串-----LCS算法的变种
今天遇到LEETCODE的第115题: Distinct Subsequences Given a string S and a string T, count the number of disti ...
- lsof 命令用法详解
lsof 命令用法详解 作用 用于查看你进程开打的文件,打开文件的进程,进程打开的端口(TCP.UDP).找回/恢复删除的文件.是十分方便的系统监视工具,因为lsof命令需要访问核心内存和各种文件,所 ...
- DeepCTR专题:Neural Factorization Machines 论文学习和实现及感悟
papers地址:https://arxiv.org/pdf/1708.05027.pdf 借用论文开头,目前很多的算法任务都是需要使用category feature,而一般对于category f ...
- c++ string 转double
#include <iostream>#include <sstream> //使用stringstream需要引入这个头文件using namespace std; Type ...
- 最近学习的 Node.js 基础:安装、环境配置、forever
最近工作中,因为某某某某原因,需要用到Node.js . 发现在很多方面和python很像,比如generator / yield ,比如模块的使用方式,比如http模块. 先安装个环境,windo ...
- c++ — 运算符重载与strcmp自实现
#include <iostream> #include <string.h> #include <stdlib.h> using namespace std; c ...
- Date对象方法
创建Date new Date() Date对象方法: get系列: getDate() 返回一个月中的某一天(1-31) getDay() ...
- matlab批量读取一个文件夹里类似命名的mat文件
参考网址: Matlab读取同一路径下多个txt或mat文件总结 matlab 批量读取数据文件.mat .dat 整理:matlab批量读入数据文件的方法 首先命名方式体现在只是名字里数字有变化,其 ...