Topic 1:400~499 4 Occurrences: 1. PTA Submission List
2. Design Ideas
- First create a function int fun (int x)
- Defines the number of times a variable is used to register a number with 4, a to calculate the size of the number of digits
- Count is assigned to value 0;
- do{//This loop structure is used to determine the number of occurrences of the digit 4
a=x%10;
if (a==4)
count++;
X=X/10;
}while (x!=0);
return value to main function
3. Problems encountered in debugging process and PTA Submission List situation description.
The debugging process found that no matter what X value, have been count++, and later found my (a=0) error near count++
Topic 2: Use a function to output an inverse number of an integer 1. PTA Submission List
2. Design Ideas
- Defines a function int reverse (int number)
- Defines the value of the variable number1 equal to the absolute number of number, flag for the sign, count for the number of digits, and i,j for the loop
- If number is positive, then number1=number;
- If number<0) number is converted into his absolute value flag=-1*flag;
- do{//number of digits to be calculated
NUMBER=NUMBER/10;
count++; Number of digits used to record numbers
}while (number!=0);
- for (i=1;i<=count;i++) {//This loop structure is used for reverse order number
a=number1%10; To find the size of the number of digits, the remainder
for (j=1;j<count+1-i;j++) {//used to put the number of digits before the cart
a=a*10;
}
Sum=sum+a; Used to find the number of the cart and
NUMBER1=NUMBER1/10;
}
Returns the value of Sum
3. Problems encountered in debugging process and PTA Submission List situation description.
At first, there is no variable to store the value of the original number, which results in 0 regardless of the input.
After debugging, the value of number was found to be 0 when entering the for loop
Topic 3: Using functions to output Daffodils number 1. PTA Submission List
2. Design Ideas
- Create a function int narcissistic (int number)
- Define variable i,n=0,sum=0,count=0 (for several numbers);
- N=number
- while (n) {//asks for several numbers of input values
count++;
n/=10;
}
- while (n) {//For the sum of n power of the number on each bit
i=n%10;
Sum =sum+ (int) Pow (i, count);
n/=10;
}
- Determines whether sum is equal to number//to determine if sum is equal to # to identify the return value
- create void Printn (int m, int n)
Define variable i;
for (i=m+1;i<n;i++)//Call narcissistic (), ask for M,n
if (narcissistic (i) ==1)
printf ("%d\n", I);
3. Problems encountered in commissioning process and PTA submission List status note
The problem on the dev output and answer match, on the PTA part correctly, after several times on the dev input different values, found i<=n error.
Second, peer code peer evaluation
My Code
The Code of Le Country
- Our two code ideas, the country's code to use the POW relatively concise, but he did not comment, read more laborious.
Third, this week's topic set PTA Final ranking.
Iv. Study Summary of the Week 1. What did you learn? What data types are 1.1 C languages?
C language data types have just begun int,double,float, newly learned to have Short,long, have characters and no characters
1.2 Character type data need to be aware of the place?
Character data should be aware of the asc| of input character numbers | The code is different from the math number.
1.3 Self-increment decrement operator?
Almost already mastered, should pay attention to the difference between ++a and a++, the previous result has been added one, the back has not
1.4 Operator Precedence?
For operator Precedence I am now thinking of Monocular, the trinocular operator is right-to-left, and for the priority it is necessary to continue practicing to fully remember
1.5 which expressions are in C language? What do you do wrong in class, please analyze the reason here?
- Arithmetic expression, self-increment decrement expression, comma expression, logical expression,
In class 2.4.10, the mistake is that the logic operation is not understood clearly for the self-increment.
1.6 Other content?
Learned a number of if statement programs to judge this little knowledge point, learned A and B values to convert each other's high-efficiency code
2. This week's content, you are not what?
In fact, I will not be the space problem of the solution, for 2 binary is not very clear
3. Circular structure Examination Summary 1. What is wrong and how to change it?
4th, 5, fully understand the meaning of the topic and the implied conditions, the remedy
2. is the exam result satisfactory, how to improve?Dissatisfaction, for the future of the topic do wrong on the PTA display to understand the meaning of PTA display error, and spend more time in C language
3. Other summaries.
The first is that the resolution of the space is not resolved in place, some implicit restrictions on the topic did not understand in place.
C Language Blog Job--function