Topic 7-1 Calculating workers ' wages
1. Design Ideas
(1) The first step: observing test instructions to understand the meaning of each parameter and the required function in the topic;
The second step: the design of the algorithm to write functions, so that function functions to achieve the functions required in the topic;
Step three: Run the program to detect errors.
(2) Flowchart
No
2. Experiment Code
#include <stdio.h>intMain () {intN,i; scanf ("%d",&N); structCJ {Charname[Ten]; floatx, Y, Z }lcj[ +]; for(i=0; i<n;i++) scanf ("%s%f%f%f",&gz[i].name,&gz[i].x,&gz[i].y,&gz[i].z); for(i=0; i<n;i++) printf ("%s%.2lf\n", gz[i].name,gz[i].x+gz[i].y-gz[i].z);}
Topic 7-2 Calculating the average score
1. Design Ideas
(1) The first step: observing test instructions to understand the meaning of each parameter and the required function in the topic;
The second step: the design of the algorithm to write functions, so that function functions to achieve the functions required in the topic;
Step three: Run the program to detect errors.
(2) Flowchart
No
2. Experiment Code
#include <stdio.h>intMain () {intI,n;floatz=0; scanf ("%d",&n);structstu{Charname[Ten];floatx;Chary[Ten];} stu1[ +]; for(i=0; i<n;i++) {scanf ("%s%s%f",&stu1[i].y,&stu1[i].name,&stu1[i].x); Z=z+stu1[i].x;} Z=z/n*1.0;p rintf ("%.2f\n", z); for(i=0; i<n;i++)if(stu1[i].x<z) printf ("%s%s\n", STU1[I].NAME,STU1[I].Y);}
C-language third time job