
已解决问题
谷歌kmatting用户在2013.05.25提交了关于“深渊主宰有3个学生,每个学生的**包括学号、姓名和3门课程的成绩,要求输出各学生学号、姓名和平均分。”的提问,欢迎大家涌跃发表自己的观点。目前共有1个回答,最后更新于2024-11-27T05:10:21。#include<stdio.h>intmain()
{
structstudent//声明一个结构体类型structstudent
{
int**m;
charname[10];
floatscore[3];//3门课程成绩
float**g;//平均分
};
structstudentstu[3];//定义含3个元素结构体数组
inti,j;
for(j=0;j<3;j++){
scanf("%d%s",&stu[j].**m,stu[j].name);
for(i=0;i<3;i++)
scanf("%f",&stu[j].score[i]);
}
//*********************************************************
floattotle=0;
for(j=0;j<3;j++){
for(i=0;i<3;i++)
totle=totle+stu[j].score[i];
}
stu[j].**g=totle/3;
for(j=0;j<3;j++)
printf("%d%-5s%2.1f\n",stu[j].**m,stu[j].name,stu[j].**g);
//============================================================
return0;
}
结果不正确,哪里错了?希望大家能够帮助她。
详细问题描述及疑问:#include<stdio.h>
intmain()
{
structstudent//声明一个结构体类型structstudent
{
int**m;
charname[10];
floatscore[3];//3门课程成绩
float**g;//平均分
};
structstudentstu[3];//定义含3个元素结构体数组
inti,j;
for(j=0;j<3;j++){
scanf("%d%s",&stu[j].**m,stu[j].name);
for(i=0;i<3;i++)
scanf("%f",&stu[j].score[i]);
}
//*********************************************************
floattotle=0;
for(j=0;j<3;j++){
for(i=0;i<3;i++)
totle=totle+stu[j].score[i];
}
stu[j].**g=totle/3;
for(j=0;j<3;j++)
printf("%d%-5s%2.1f\n",stu[j].**m,stu[j].name,stu[j].**g);
//============================================================
return0;
}
结果不正确,哪里错了?期待您的答案,你就是当代的活雷锋,太感谢了
!