Input format:
Input data from three students, each student a line of data format is as follows: & lt; Student id & gt;
The output format:
Out of the first in line 1 of the output of 3 students grade point average, the average output format for accounted for 10, 1 decimal place,
In line 2 output data, the highest students format is as follows: No=& lt; Student id & gt; , Name=& lt; Name & gt; The Score1=& lt; The first course grades & gt; , Score2=& lt; The second course grade & gt; , business=& lt; Average & gt;
Note: keep the output of the course grades and gpa 1 decimal places and rounded,
Input the sample:
20180001 zhangsan 70.0 80.0
20180002 lisi 95.0 89.0
20180003 wangwu 65.0 84.0
The output sample:
75.0 92.0 74.5
No=20180002, Name=lisi, Score1=95.0, Score2=89.0, business=92.0
The referee sample testing program:
#include
Int main () {
Please fill in the answer here */*/
Printf (" Name=\ nNo=% s, % s, Score1.=% 1 f, Score2.=% 1 f, business.=% 1 f ", s [Max] no, s [Max]. Name, s [r]. Max Score1, s [r]. Max Score2, s [Max] business);
Return 0;
}
This is the code I wrote
Struct student
{
Char no [9];
char name[20];
Float score1.
Float score2;
Float business;
} s [3].
Int m, n, Max;
Float sum [3].
For (n=0; n<3; N++)
The scanf (" % s % s % f % f ", s [n]. No, s [n]. The name, & amp; S [n]. Score1, & amp; S [n]. Score2);
For (n=0; n<3; N++)
S [n]. Business=(s [n]. Score1 + s [n]. Score2)/2.0;
Printf (" % 10.1 f % 10.1 f % 10.1 f ", s [0]. Business, s [1]. Business, s [2]. Business);
For (m=0; M<3; M++)
If (sum [n] & gt; The sum [m])
Max=n;
CodePudding user response:
It's probably an it site bugCodePudding user response:
Try to get rid of the inside of the printf SpacesCodePudding user response:
20180001 zhangsan 70.0 80.020180002 lisi 95.0 89.0
20180003 wangwu 65.0 84.0
Numerical read error?