Home > Back-end >  For help, to write a C language program, don't use structure
For help, to write a C language program, don't use structure

Time:06-02

The course design of experiment to make the students grasp accurately the array complex data type application methods and skills, understand the modularization program design idea, learn to function programming, learning VS.Net 2010 senior integrated development environment using method, the specific requirements of the experiment are as follows:
1, in order to higher mathematics (5 units), English (6 credits), discrete mathematics (4 credits) and program design basis (3 credits), four classes of grade for the appraisal result,
2, the number of class 30,1,2,3 scholarship number 1 respectively, such as three people, 6 people,
Prerequisite: 3, won a scholarship must pass all courses and grade point is greater than 5.99, the only branch grade grade point formula:
60 points corresponding to this course grade point of 2 (2) all the courses are, every cent increase 0.2 gpa, namely:
Less than 60 minutes, the grade point of 0
Equal to 60 points, then the grade point of 2
Greater than 60 points (assuming for 86 points), the point is:
2 + (86-60) * 0.2=7.2
This semester total grade point formula:
∑ (the credits of each course by gpa)
∑ the credits of each course
4, calculate all students from the measuring rankings, from big to small order, the calculation formula:
Activities by 0.25 + (50 + grade point x 5) x 0.75
Note: activity points set to a constant, students of the experimental setup,
From 5, according to the measuring list, choose the list of scholars such as 1, 2, 3 (think 3rd place is less than 6
People),
6, the achievement of four classes must be read from the file!

CodePudding user response:

No structure?? It shall not be afflictive dead
No, must use structure

CodePudding user response:

#include
#include
# define N 4
Struct student
{
Char xuehao;
Char name;
int a;
int b;
int c;
Int d;
Double zongce;
} STR [10].
Double fun (int x, int y, int z, int v);
Int main ()
{
Struct student temp.
Int I, j, k=0;
Double jidian [10].
The FILE * fp.
If ((fp=fopen (" D: \ \ 1. TXT ", "r"))==NULL)
{
Printf (" unable to open file \ n ");
getchar();
The exit (1);
}
For (I=0; i <10; I++)
{
Fscanf (fp, "% s % s % d % d % d % d", & amp; STR [I]. Xuehao, & amp; STR [I]. Name, & amp; STR [I] a, & amp; STR [I]. B, & amp; STR [I]. C, & amp; STR [I]. D);
Jidian [I]=fun (STR [I] a, STR [I]. B, STR [I]. C, STR [I] d);
If (jidian [I] & gt; 5.99 & amp; & STR [I] a & gt; 60 & amp; & STR [I]. B & gt; 60 & amp; & STR [I]. C & gt; 60 & amp; & STR [I] d & gt; 60)
{
STR [I] zongce=(jidian [I] 50) * 5 + 0.75 + 0.25) (N * *;
k++;
}
}
For (I=0; i {
For (j=1; j {
If (STR [j] zongce & lt; STR [j + 1] zongce)
{
Temp=STR [j];
STR [j]=STR [j + 1);
STR=\ [j + 1];
}
}
}
Printf (" \ n the list that could satisfy the requirement of scholarship ");
Printf (" student id name \ n ");
For (I=0; i {
Printf (" % s % s \ n ", STR [I] xuehao, STR [I] name);
}
Printf ("... \n");
Printf (" first-class scholarship: \ n ");
Printf (" student id name \ n ");
For (I=0; i <1; I++)
{
Printf (" % s % s \ n ", STR [I] xuehao, STR [I] name);
}
Printf (" second-class scholarship: \ n ");
Printf (" student id name \ n ");
For (I=1; i <4. I++)
{
Printf (" % s % s \ n ", STR [I] xuehao, STR [I] name);
}
Printf (" third-class scholarship: \ n ");
Printf (" student id name \ n ");
For (I=4; i {
Printf (" % s % s \ n ", STR [I] xuehao, STR [I] name);
}
fclose(fp);
getchar();
return 0;
}
Double fun (int x, int y, int z, int v)
{
Double jidian1 jidian2, jidian3 jidian4, jidian;
If (x & gt;=60)
{
Jidian1=(x - 60) * 0.2 + 2;
}
The else
{
Jidian1=0;
}
If (y & gt;=60)
{
Jidian2=(y - 60) * 0.2 + 2.
}
The else
{
Jidian2=0;
}
yIf (z & gt;=60)
{
Jidian3=(z - 60) * 0.2 + 2.
}
The else
{
Jidian3=0;
}
If (v & gt;=60)
{
Jidian4=(v - 60) * 0.2 + 2.
}
The else
{
Jidian4=0;
}
Jidian=(jidian1 * 4 + 5 + 6 + jidian3 jidian2 * * jidian4 * 3)/18;
Return jidian;
}

CodePudding user response:

Check wrong? Where there is wrong

CodePudding user response:

I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10581430.html
I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10768339.html
  • Related