C language work 05

problem Reply
This work belongs courses C language programming ll
Where the job requires https://edu.cnblogs.com/campus/zswxy/SE2019-2/homework/9830
My aim in this course is Society of power and factorial operation, a better understanding of programming, learn the custom function
In particular aspects of the job which helped me achieve goals pta experimental work to understand the function parameters
references "C Programming Language" program website codecademy.

PTA lab assignments

1.1 title 6-3

Topics requirements: a function required to achieve this question, it is determined whether any integer number daffodils (must be three digits, each digit and the number itself is equal to the cube and the number). E.g. 153 + 5 = 1 ^ 3 ^ 3 ^ 3 + 3 + 1 = 125 + 27 = 153, and 1 155 or not narcissistic number. If the number of daffodils, the function returns 1, otherwise it returns 0.

1.1.1 Data Processing

1. Expression Data: int defines five using integer variable, uses the const reference line such that the variable N after initialization, can not be modified.
2. Data processing: Using a cyclic structure for-else, by computing Q = S Q Q W + W W + E E E is operated.
3. Function Parameter: main function int main (), func () is called to function as a reference line N, the argument of q, w, e, s, t.

1.1.2 Screenshot experiment code.

1.1.3 build test data

Input data Output Data Explanation
21 0 Not the three-digit
212 0 Members of the cube and the number is not equal to 212
153 1 Members of the cube and the number is equal to 53
22145 0 Five digits

1.1.4PTA commit


1 compilation errors: ./ became a hit, hit into 8 * ";" labeled "."
2. Compile error: int not with a capital N is defined when the reference line.
3. partially correct: the assignment operator p hit into q.

1.2 title 6-1

Topics requirements: write function fun, which is: determining an integer and the sum of the squares of the digits can be divisible by 5, can be divisible by 5 returns 1, and 0 otherwise.

1.2.1 Data Processing

1. Data are expressed: int defined by the integer variable s i, using scanf output variables n, use of "%" symbol remainder assignment operator.
2. Data processing: while syntax used for calculation cycle, do call the scanf output computation.
3. Function parameters: main main function, the line parameters n, arguments i, s, call the function func ().

1.2.2 Code Screenshot

1.2.3 build test data

Input data Output Data Explanation
14 0 Square and a multiple of 17, not 5 of each digit.
20 0 Square and a multiple of 4, not 5, each digit.
125 1 Members of the square of the number of 30 and is a multiple of 5.
81 1 Square for you and the number 65, it is a multiple of 5.

1.2.4PTA submit a list and description


1. compilation errors :( "% d", & n ); double quotes hit the back of the n, and did not play an ampersand.
2. Compile error: return (s% 5 == 0 ); hit into (S = 0. 5%);
3. compile error: input and output variables assigned reversed.
4.n less a! .

2 Code peer assessment

2.1 classmate Code

My code

Code comparison
1. defines three students and two, and five own definition of the same type of variable.
2. The first student useless while statement, and the second with the students, and he is useless.
3. classmates, less variable definitions, the students directly assign the second reference line N so as to define the variable n less, it is more straightforward procedure.
4. Students Second, assign fewer, more conducive to the preparation and examination.
The students use a more simple computing architecture, reducing the programming code.

3. learning summary

3.1 learning progress bar

Week / Date This week the time spent The number of lines of code Learned knowledge Introduction
9/10.23-10.26 12 120 I learned to explain the function, call the function, learned const qualifier.

3.2 blog with the number of lines of code words

3.3.1 learning content summary

mind Mapping

3.3.2 Learning Experience

1. This is an important week to learn knowledge, is the definition of a function in class listening to a very simple but homework, you should not feel difficult this timely review because of it.
2. Code fight most painful is accidentally hit the Chinese symbols, check also terrible. So I'll be more careful.
3. I felt my logical thinking needs to be strengthened.
4.printf and scanf relationship is not very clear.
5. Additional information "string" can not have Chinese appear.

Guess you like

Origin www.cnblogs.com/zxxm/p/11742180.html