C language blog job I work 04

C Voice blog I work 04

  • This work belongs to the curriculum C Programming Language II
    Where the job requires https://edu.cnblogs.com/campus/zswxy/CST2019-3/homework/9771
    My aim in this course is Learn C language, can quickly and accurately programming
    This job helped me achieve that goal in terms of specific Learn to use the for statement
    references "C Programming Language" "PTA experimental guidance"

    1, PTA lab assignments

    1.1 calculating partial sequence and the inverse of the square of

  • Description Title: The title requires two positive integers m and n (m≤n) programming, and the calculation sequence m2 + 1 / m + (m + 1) 2 + 1 / m + (m + 1) 2 + 1 / (m + 1) + ⋯ + n 2 + 1 / n.

    1.1.1 Data Processing

  • Expression Data: Application to define int integer variable m and n, defined by two double double precision floating-point variables.
  • Data processing: using the expression: sum = sum + pow (m, 2) + 1.0 / m; for statement circulated.

    1.1.2 Screenshot experiment code

    1.1.3 build test data

  • Input data Output Data Explanation
    1 5 57.283333 m=1,n=5
    1 10 387.928968 m=1,n=10
    5 10 355.845635 m=5,n=10
    2 20 2871.597740 m=2,n=20

    1.1.4 PTA submit a list and description

  • 1. Compile error: the int integer variables should be defined, but with the "% f" into "% d"
  • 2. Partial correctly: for statement "m = m + 1", has written "m = m + 2"
  • 3. Wrong answer: for statement in the expression "sum = sum + pow (m, 2) + 1.0 / m" 2 written in the 1.

    1.2 Title 2 interlaced sequence request and first N

    1.2.1 Data Processing

  • Data representation: direct application of the definition of double double precision floating point variables, input data.
  • Data processing: processing for statement "sum = sum + flag * i / denominator; flag = -flag; denominator = denominator + 2;" cyclic operation.

    1.2.2 Code Screenshot

    1.2.3 build test data

  • Input data Output Data Explanation
    2 0.333 i = 2 run results
    3 0.933 i = 3 Run Results
    5 0.917 i = 5 Run Results
    8 0.910 i = Run 8 results

    1.2.4 PTA submit a list and description

  • 1. Compile error: the start of "flag = -flag" I did not write, find a few times after correction
  • 2. Answer Error: The "sum = sum + flag * i / denominator;" written in the i-1.
  • Part 3. Error: Other programs used is N, and "scanf ("% lf ", & N);" was written in the n. After the correct answer is correct.

    2. Code peer assessment (5 minutes)

    Screenshot students Code

    Own Code Screenshot

  • 1. The students spent two main functions, mathematical function called header files. I only had a main function.
  • 2. He used a double-type input format, I direct int.
  • 3.for statement I only had a function expression, feeling easier.

    3. The study concluded (15 points)

    3.1 Learning progress bar (5 points)

  • Week / Date This week the time spent Lines of code Learned knowledge Introduction Currently more confusing issues
    4/15-4/18 20h 70 I learned for the statement, but also a better understanding of the overall int or double and some confusion

    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

  • This week a major study for the statement, did not feel how to learn, but the basic thing to know. for statements, there are some caveats, such as: for later statement can not add a semicolon, there must have braces around the loop.
    For example; for (I =. 1; I <= N; I ++) {
    SUM = SUM + 1.0 / I;
    }

3.3.2 Learning Experience

  • I do my homework this week is the longest of the week, feeling a little difficult job, but it is also very interesting to do, sometimes annoying, especially PTA, a question they do 20, as well as less likely to double and int distinguish.

Guess you like

Origin www.cnblogs.com/zzh6/p/11688473.html