C language I blog work 07PTA & blog Deadline

problem answer
This work belongs to the curriculum C Programming Language II
Where the job requires Job Link
My aim in this course is Learn and master the basic knowledge of C language, C language code that can be related to a variety of
This job helped me achieve that goal in terms of specific Learn to use a switch statement
references C Programming Language (3rd Edition)

1.PTA lab assignments (20 points / questions)

Please list your ranking pictures here, such as:
Image (1) .png

1.1 7-12 student achievement statistics (15 points)

题目内容描述:本题要求编写程序读入N个学生的百分制成绩,统计五分制成绩的分布。百分制成绩到五分制成绩的转换规则:大于等于90分为A;小于90且大于等于80为B;小于80且大于等于70为C;小于70且大于等于60为D;小于60为E。输入格式:输入在第一行中给出一个正整数N(≤1000),即学生人数;第二行中给出N个学生的百分制成绩,其间以空格分隔。输出格式:在一行中输出A、B、C、D、E对应的五分制成绩的人数分布,数字间以空格分隔,行末不得有多余空格。

1.1.1 Data Processing

数据表达:我用了N、i、mark、sum、A、B、C、D、E这些变量,其中N和mark都是用scanf函数来赋值,i定义初始值为1,sum是用if-else语句来进行赋值,A、B、C、D、E定义初始值都为0,它们都是整型;
数据处理:
   for(i=1; i<=N; i++)
    给mark赋值
    if判断语句
    sum=1~5
    switch(sum)
    case 常量表达式sum(1~5): A~E(累加)
    输出A、B、C、D、E的值 

1.1.2 Screenshot experiment code

1.1.3 build test data

Input data Output Data Explanation
7,77 54 92 73 60 65 69 1 0 2 3 1 With the data given topic
5,100 100 100 100 100 5 0 0 0 0 All 10
5,90 80 70 60 50 1 1 1 1 1 There are people in the five-point scale

1.1.4 PTA submit a list and description

提交列表说明:
    1.答案错误:在后面出现了sum这个变量,而在前面没有定义sum;
    2.答案正确:int后面加一个sum答案就正确了。

1.2 Question 2

1.2.2 Code Screenshot

1.2.3 build test data

Input data Output Data Explanation

1.2.4 PTA submit a list and description

2. Code peer assessment (5 minutes)

2 parts of the code to find the students, and their own code comparison, the proposed peer review of code to try to find coding style quite different.

Screenshot students Code

Own Code Screenshot

2 parts of 1,2,3 list mode code in the different places.

3. The study concluded (15 points)

3.1 Learning progress bar (5 points)

week This week the time spent Lines of code Learned knowledge Introduction Currently more confusing issues
9/17-9/22 5 hours Line 43 Learn to write simple code no
9/24-10/4 6 hours Line 62 Society temperature conversion no
10/6-10/13 11 hours Line 86 Learn to write functional programs I do not know how to call scanf under what circumstances () function
10/14-10/20 10 hours 105 for
Loop and the loop structure I do not know how many variable definitions
10/21-10/27 10.5 hours 114 line Learn how to define a function and its basic format For the title programming function does not know how to go design
10/28-11/3 12 hours 135 line Learn two branch structure and if-else statements For confusion exists enter a positive integer, and enter a corresponding number of values ​​of coding
11/4-11/10 hour 0 0 0

3.2 Cumulative lines and word blog (5 minutes)

3.3 Summary and perception of learning content (5 points)

3.3.1 learning content summary

这周我们学习了C语言中的switch语句,switch有的时候可以简化if-else语句的繁琐性,还可以实现多分支结构,当符合条件时用break跳出然后输出。switch语句要与前面有很好的衔接,而且要思考怎么去设计常量表达式可以体现出程序有条不紊。

3.3.2 Learning Experience

这一周的PTA作业题目的量减少了好多,但是题目的难度系数越来越大,而且老师规定必须每个题目要用switch语句,有些题目好用,但有些题目感觉上不怎么好用,因为我理不清逻辑关系,并且还存在题目都没有看懂。我觉得switch语句的关键在于那个常量表达式,如果没有理清关系,就会导致答案出错。当然,这都需要自己去不断努力,而且还得需要不断坚持多练,才可以让自己变得更加优秀。

Guess you like

Origin www.cnblogs.com/classtest123/p/11808715.html