C language | blog work 04

This work belongs courses C Programming Language 1
Where this requirement in the job https://edu.cnblogs.com/campus/zswxy/SE2019-2/homework/9774
In this course aims The use of the structure through the bad compiler purpose program.
references "C Programming Language" "C Primer Plus"

1.PTA lab assignments

1.1 Title name: items and ask N, N of the programming sequence before computing sequence 1 1/2 + 1/3 + ... + a sum of the first N, and the value of the output portion S, decimal place 6.

1.1.1 Data Processing

Data processing: use int, double data type defined variables.
Data are expressed: through the bad use of the structure, equal to, less than or equal to two relational operators, increment (+) arithmetic operators, the use of (% d) and (% f) format control.

1.1.2 Screenshot experiment code

1.1.3 build test data

Input data Output Data Explanation
6 2.450000 Less than 50
67 4.789352 More than 50
103 5.216791 More than 100
-2 0.000000 Less than 0

1.1.4 PTA submit a list and description


Submit a list of instructions

  1. Compile Error: Due to carelessness, (stdio.h) wrote a letter wrong. Output an error message "stdio.n" does not exist. Correct this error.
  2. Compile Error: a closer look at the code will find a variable declaration statement to a comma-separated variable mistakenly written semicolon. Correct this error.
  3. Compile Error: double-check the source, find printf function format control characters missed "%." Correct this error.
  4. Compile Error: a closer look at the code found return 0, less behind a semicolon caused by procedural errors. To correct this error.
  5. Compile Error: The sum also define data for int variables result in a compilation error, the correct answer is correct.

    1.2 Title name: N seek before simple interleaving sequence items and calculates sequence - 1/4 + 1/7 - 1/10 ... + a sum of the first N, and the output portion of the value S three decimal place place

    1.2.1 Data Processing

    Data processing: use int, double data type defined variables.
    Expression Data: Application-circulating structure and branch structure, equal to, less than or equal to two relational operators, increment (+) arithmetic operators, the use of (% d) and (% f) format control.

    1.2.2 Code Screenshot

1.2.3 build test data

Input data Output Data Explanation
2 0.750 Less than 50
67 0.838 More than 50
134 0.834 More than 100
-7 0.000 Less than 0

1.2.4 PTA submit a list and description of ####

Submit a list of instructions

  1. Compile Error: In the beginning there is no clear idea of ​​if-else statements written, the program error, the program does not work properly. To correct this error.
  2. Compile Error: The fourth line is not properly indented. To correct this error.
  3. Compile error: the sign bit is not properly controlled. To correct this error.
  4. Compile Error: if statement to execute code condition is satisfied, the lack of an braces {}. To correct this error.
  5. Compile Error: a closer look at the code found else statement, the condition clerical error. My writing is satisfied by the judge on the line but the statement arithmetic operators in the else statement clerical error due to carelessness, resulting in the program not function properly. To correct this error.
  6. Compile Error: else statement error indent, the program does not deviate from the program output. To correct this error.
  7. Compile error: for brackets after the implementation of a conditional statement to play more of a semicolon the program can not be carried out through the bad. The syntax for the statement seen, through the bad body statement is a statement only, and can not therefore semicolon before {}. To correct this error.
  8. Compile error: the 1.0 / a written as 1 / a, of attention data type running order. To correct this error. The answer is correct.

    2. Code peer assessment

    Screenshot students Code


Own Code Screenshot

different

first question

  1. While we are all through the bad use for the structure, but the students selected topic is the use of decrement operator, and I am increment operator.
  2. I selected topic classmates code corresponding to i is more concise, my code becomes bloated compared with him.

The second question

  1. I using if-else branch structure is determined prior to seek simple parity interleave and a sequence of N entries.
  2. It is selected by the students through the bad program structure for each time through the bad directly assigned to f -f simple to evaluate a sequence of N entries and before interleaving.
  3. I define the relative number of variables selected students defined variable is relatively small, the entire code looks simple, intuitive ideographic.

    3. learning summary

    3.1 learning progress bar

Week / Date Time spent Lines of code Learned knowledge Introduction Currently more confusing issues
W7 20h 198 Data type Double Double precision floating point type; arithmetic operators; if-else statement selection structure like Common types of difference data
W8 15h 87 Through the bad configuration, the arithmetic operators increment operator The priority order of the operators

3.2 lines of code words and blog Park

3.3 learning content and insights

3.3.1 learning content summary

Through the bad configuration, the arithmetic operators increment operator. Logical operator logical AND (&&) and logical OR (||)

3,3,2 learning experience

  1. With the deepening of learning, C language classes no longer seems so boring tough relic at the beginning, the mouth of the teacher professional terms no longer so bitter and difficult, even slowly becomes interesting. However, the ensuing constantly stringent operational requirements, the difficulty gradually increase, never a job to adapt our learning progress, but do not understand never learned through self-study to complete the job. A certain self-learning ability is a university study as essential! So Keep up! ! !
  2. By accepting effect in class he taught and content point of view of the teacher, and now what they have learned very little from the c language classes, self-understanding and application point of view on many questions to do basic concept, I was learning very the surface is very vague and even did not understand.
  3. Although we are engineering students, but a lot of things not only need a deep level of understanding, but also a real need in mind, the memory of many statements of special symbols familiar to bear in mind the need to go!

Guess you like

Origin www.cnblogs.com/tizipei/p/11685886.html