C-1 blog 03 jobs

problem answer
This work belongs to the curriculum C Programming Language 1
Where the job requires https://edu.cnblogs.com/campus/zswxy/CST2019-1/homework/8715
My goal in this course Learn C language, as C ++, Java lay the foundation for learning
The specific job in helping me achieve that goal Grasp the relationship between the operation and learn if-else statement, the statement scanf formatted input
references Baidu, ACM problem-solving, leecode interview several topics Site

1.PTA lab assignments

1.1 Electric-order ladder

1.1.1 Mapping

1.1.2 Data Processing

This problem is based on questions conditional statement using if-else statements to execute, that is, the point to note: output electricity printf ( "cost =% .2f", cost); the location of this statement, (write in conditional statement inside) because when electricity <0, the electricity is not output.

1.1.3PTA submit a list and description


This problem appeared compile errors, mistakes for a long time, in the end is written as a comma semicolon, and she did not put printf ( "cost =% .2f", cost); This statement put on the position, and later to find the answer by Baidu

1.2 the output of the triangle area and the perimeter

1.2.1 Mapping

1.2.2 Data Processing

This requires that the need to see the subject, the subject requires three positive integers calculated perimeter and area of ​​the triangle, it is necessary to use &&, "&&" indicates, is intended to be simultaneously satisfied because the knowledge "of any two sides is greater than the first triangle trilateral "this problem needs to use if-else statement to distinguish whether it can form a triangle of two cases, also need to use #include <math.h> calling mathematical functions to use to prescribe sqrt

1.2.3PTA submit a list and description


This problem themselves careless, wrong several times, at the beginning I could not find the error, that is right, finally asked the students, found that "sqrt" written "sprt", is also very funny, this code has a problem so long, so write time to pay attention, symbol error prone

1.3 fits and starts network

1.3.1 Mapping

1.3.2 Data Processing

Note that this problem is also the case in addition to the remainder of the remainder is zero when the number of natural, need to use ||, "||" is or the meaning of this title or use if-else statement to write the judge is drying nets or fishing, We need to use the remainder to write% a

1.3.3PTA submit a list and description


This problem did what wrong, would not have to write, do not understand the meaning, then Baidu search, reference some code data, and wrote out

2. Read the Code


Tags on your site are too difficult, can not read, so I find the code on the excellent teaching materials from the ACM, this problem using the if-else statement we have learned, formatted input statement scanf (), as well as common math library functions, and we are about to learn loop, loop design generally includes four parts, this problem can be just as an example of learning
, "" initialization, specify the loop starting point for the loop variable assignment.
"" Control conditions, as long as the value of the loop variable does not reach the upper limit, the cycle continues.
"", And refers to the statement repeated.
"" Loop variable change, change the value of the loop variable in each cycle.
The above is a reference to the C language programming content 1 2.4.3

3. learning summary

3.1 learning progress bar

problem answer
Week / Date 3/9-3/15
This week the time spent 3 days
Lines of code 85
Introduction to acquire knowledge if-else statement
Currently puzzling question Format control problem

3.2 Cumulative lines of code words and blog

3.3 learn insights

Week to learn if-else statements, statements Scanf formatted input, single-precision floating-point variables reviewed float, double precision floating point variable double, integer variables int, and the like binocular arithmetic operators, the rehearsal loop. By learning this week, I will be using if-else statements, loop statements to have a certain understanding, the code skilled than ever before, their own code too little, and will strengthen the code after practice, the technology needed to train.

Guess you like

Origin www.cnblogs.com/caolvtao/p/11644581.html