1. This chapter study summarizes 1.1 mind map
1.2 Learning experience and code quantity learning experience in this chapter 1.2.1 learning experience
After a week of preliminary study, I have a certain understanding of C language, but also experienced the fun of the code, which should be my future learning to open a good head. In the teacher's way of teaching feel the teacher is very responsible for the knowledge explained are in place.
Do not understand or are not proficient in respect of operator precedence, the FOR Loop statement knows little and does not apply.
1.2.2 Code Accumulation
2.PTA Total score 2.1PTA in order structure, branch structure ranking scores
2.2 My total Score:
Sequential structure: 100 points;
Branch structure: 125 points;
Total scores: 225 points.
3.PTA Lab Work 3.1 PTA Topic 1: Sequential structure 7-8
The IT Association organizes program design contests and prepares to buy USB sticks for prizes. Please write a program that can purchase the maximum number of USB flash drives based on the activity funds and the unit price estimate.
3.1.1 Algorithm Analysis
1. Variables that need to be defined: money, the unit price of a USB flash drive (number).
2. By dividing the cost (money) by the unit price of the USB flash drive, the integer portion of the quotient is the maximum number of USB drives that can be purchased. So the number is defined as int.
3.1.2 Code
3.1.3 Test Data
3.1.4 PTA Submission List and description
Q: Why do I add 0.000001 when I calculate number?
A: Floating-point Data Division will have a certain error, the problem of precision has certain requirements, to fill the precision.
3.2 PTA Topic 2: Branching structure 7-8
The subject request according to a city ordinary taxi charge standard to write the procedure carries on the fare calculation. The specific criteria are as follows:
The starting mileage is 3 kilometers, the starting fee is 10 yuan;
10 km after the super-starting mileage, 2 yuan per kilometer;
More than 10 kilometers of the portion plus 50% of the go home subsidy fee, that is, 3 yuan per kilometer;
In the course of operation, due to road obstruction and passenger demand for temporary parking, it is charged at $2 per 5 minutes (less than 5 minutes).
3.2.1 Algorithm Analysis
1. Variables to be defined: time, distance (distance), cost.
2. When the journey is within three km, the fare starts at 10 yuan.
3. When the journey is more than three km, no more than 10 km, the portion of more than three km is 2 yuan per kilometer.
4. When the journey is more than 10 km, 10 kilometers away, the fare is 3 yuan per kilometer.
5. The final total cost is the fare for the kilometer fare plus the waiting time.
3.2.2 Code
3.2.3 Test Data
3.2.4PTA Submission List and description
Q: Why do you define time as an integer variable?
A: Because the waiting time in this topic is not 5 minutes 2 yuan, less than 5 minutes no charge, the time is defined as an integer variable, time/5 is an integer,
Delete between the fractional parts, which is in line with the title requirement.
3.3 PTA Topic 3: Sequence structure 7-7
Enter three integers x, y, Z, please put these three numbers from small to large output.
3.3.1 Algorithm Analysis
1. Define x, Y, Z, define Big,millde,small to store data.
2. Use if nesting for discussion (direct).
3.3.3 test Data
3.3.4PTA Submission List and description
Q1; Why are so many answers wrong?
A1: Did not seriously when doing the problem, did not see the output of x, Y, z size order. So, after doing the problem must be serious examining.
Q2: This question can be judged in all six cases of the size of XYZ, why not.
a2:3! =6, the situation is relatively small, but if you are comparing the size of four numbers? Moreover, learning the primary stage of computer language, practice logic is very important, with if nested although feeling more troublesome, but help logical exercise.
4. Reviews Blog
C Blog 01--order, branching structure