The first homework class 4 Zhang Lu

1. Summary of learning content

    1. After several weeks of study, summarize the learning experience and experience.

 

After a few weeks of study, I feel that the C language is really difficult to learn, and I can't keep up with it if I slip a little bit. Various types of loop statements make me overwhelmed, and I still need to work hard and learn. For these classes, I think the most difficult thing is do-while and while statement loops. I'm not very good at dealing with these types of statements, and I hope to work hard to learn this statement loop in the next few weeks. The second is that there is no software for this programming in the computer. I want to find a classmate to go to the next one where I can practice hand speed and brain response in private.

2. Problems encountered in study and homework and the solution process (no less than 3 problems, 30 points)

  • Problem 1 do-while statement loop
  • Solution to problem 1: The do-while statement is similar to the while statement. It is suitable for looping first and then judging the loop conditions. Generally, the loop control conditions are specified during the execution of the loop body. After each execution of the loop body, the conditions are judged. Decide whether to do the next time, the concept probably means this, I will study hard
  • Problem 2 Nested Loops
  • Solution to problem 2: A nested loop is a small loop nested within a large loop. The inner loop is repeated i times, and each time it is multiplied by one item.
  • Question 3 break and continue statements
  • The solution to problem 3: The break statement forces the end of the loop and can be jumped out directly, but I still have some problems with this statement, I hope the next few lessons can make up for it

3. PTA work (60)

    1.7-6 Swap the values ​​of a and b You are required to enter your student ID and the value of your student ID + 5, paste the code, and a screenshot will be output (only the small image with the result will be taken).

#include<stdio.h>
int main()
{
int a , b , c ;

scanf("%d %d",&a , &b);

c = a;
a = b;
b = c;

printf("a=%d,b=%d\n",a,b);

return 0 ;
}

 

 

    2.7-7 The sum of three integers is required to output your student number, your class number, your class's elementary school number, paste the code, and a screenshot will be output.

 

#include<stdio.h>;
int main(void)
{
int a,b,c ;

scanf("%d %d %d",&a,&b,&c);

printf("sum=%d",a+b+c);

return 0 ;
}

    3.7-3 The day after tomorrow, paste the code and write out your basic thoughts and ideas in analyzing and solving the problem.

#include<stdio.h>
int main(void)
{
int a , b;
scanf("%d",&a);

if(a<=5){
b = a + 2;
printf("%d\n",b);
}
else{
b = a + 2 - 7;
printf("%d\n",b);
}

return 0 ;
}

It is brought in with the basic frame structure, and then processed with an if else statement.

4. Additional content (5 points)

     1. Registered in Mooc of Chinese University, and participated in the "Introduction to Programming-C Language Course" of Zhejiang University, requiring screenshots.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325340285&siteId=291194637