一道C语言的结构题#includestruct student{\x05char name[40];\x05long long number;\x05float ord,mid,fin,grade;};int main(){\x05struct student a={"Natsu",1001,75.0,80.0,80.0},b={"Grey",1002,90.0,70.0,80.0},c={"Lucy",1003,95.0,98.0,88.0},d={"Wendy

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/19 02:36:30
一道C语言的结构题#includestruct student{\x05char name[40];\x05long long number;\x05float ord,mid,fin,grade;};int main(){\x05struct student a={
xMkAǿ):l&iCx`<˦I%"Rj "!R4Mr+83dz5gw~3dYם^6&ǓQ{wd>C2S,CidX6([ ZzmP^ZN`C߱#%aJ* C}y۩RfB~hrv!V:)UZ_r]s?mZYm3 S닒J8@F&6Di(PD"e.dNh; 钝j;v%;v,lXVU1r'yV>'9a9w'ρ)%Ć<$2d$Oj<IHDMEH6EHB:''"d!2M|BUB˴\5As eI5{Sl{㾽(2J6 Vb5t _~6r<

一道C语言的结构题#includestruct student{\x05char name[40];\x05long long number;\x05float ord,mid,fin,grade;};int main(){\x05struct student a={"Natsu",1001,75.0,80.0,80.0},b={"Grey",1002,90.0,70.0,80.0},c={"Lucy",1003,95.0,98.0,88.0},d={"Wendy
一道C语言的结构题
#include
struct student
{
\x05char name[40];
\x05long long number;
\x05float ord,mid,fin,grade;
};
int main()
{
\x05struct student a={"Natsu",1001,75.0,80.0,80.0},b={"Grey",1002,90.0,70.0,80.0},c={"Lucy",1003,95.0,98.0,88.0},d={"Wendy",1004,80.0,80.0,80.0};
\x05a.grade=0.5*a.ord+0.2*a.mid+0.3*a.fin;
\x05b.grade=0.5*b.ord+0.2*b.mid+0.3*b.fin;
\x05c.grade=0.5*c.ord+0.2*c.mid+0.3*c.fin;
\x05d.grade=0.5*d.ord+0.2*d.mid+0.3*d.fin;
\x05printf("%s的总分是:%f\n学号:%d\n 平常成绩:%f\n期中成绩:%f\n期末成绩:%f\n\n",a.name ,a.grade ,a.number ,a.ord,a.mid ,a.fin );
\x05printf("%s的总分是:%f\n学号:%d\n 平常成绩:%f\n期中成绩:%f\n期末成绩:%f\n\n",b.name ,b.grade ,b.number ,b.ord ,b.mid ,b.fin );
\x05printf("%s的总分是:%f\n学号:%d\n 平常成绩:%f\n期中成绩:%f\n期末成绩:%f\n\n",c.name ,c.grade ,c.number ,c.ord ,c.mid ,c.fin );
\x05printf("%s的总分是:%f\n学号:%d\n 平常成绩:%f\n期中成绩:%f\n期末成绩:%f\n\n",d.name ,d.grade ,d.number ,d.ord ,d.mid ,d.fin );
\x05return 0;
}
为什么输出的平常成绩等都是0,编译器是VS2010

一道C语言的结构题#includestruct student{\x05char name[40];\x05long long number;\x05float ord,mid,fin,grade;};int main(){\x05struct student a={"Natsu",1001,75.0,80.0,80.0},b={"Grey",1002,90.0,70.0,80.0},c={"Lucy",1003,95.0,98.0,88.0},d={"Wendy
printf("%s的总分是:%f\n学号:%d\n 平常成绩:%f\n期中成绩:%f\n期末成绩:%f\n\n",a.name ,a.grade ,a.number ,a.ord,a.mid ,a.fin ); 所有的输出中%d\n 平常成绩改为%f\n就行了