0
Follow
0
View

How to define the i in the [] of stu in line 10

dunmas 注册会员
2023-02-25 23:14

the reference answer GPT ᴼ ᴾ ᴱ ᴺ ᴬ ᴵ < br / > in the first ten lines, stu is a struct array, the array subscript I said the ith student information. Therefore, i should be an integer value from 0 to n-1, representing the subscript of the student whose total score needs to be calculated.

When the function is called, you should pass n to indicate the number of students, for example:

STU students[4];
// 初始化学生信息...
totalscore(students, 4, 4);


treedu 注册会员
2023-02-25 23:14
stu { long stuID; //学号 char stuname[10]; //名字 char stusex; //性别 DATE birthday; //生日 int score[4]; //4科分数 float aver; //平均分 }STU; .
< !- - - - - >
cxmhaoya 注册会员
2023-02-25 23:14
< div class = " md_content_show“数据- v - 3967 e397 = " " >

 
typedef struct stu
{
    long stuID;     //学号
    char stuname[10];    //名字
    char stusex;     //性别
    DATE birthday;   //生日
    int score[4];    //4科分数
    float aver;      //平均分
}STU;

dafa1680 注册会员
2023-02-25 23:14

Function entry should be defined as an array of structs, STU stu[]

chaishian 注册会员
2023-02-25 23:14
  • You put out the definition of STU, is it an array of structs?
  • Your input should be defined as a struct array STU stu[]