#include<stdio.h>
struct student
{
int num;
char name[20];
char sex;
int age;
float score[3];
};
struct student stu[2] = {{1,"СÍõ",'m',11,99,98,97},{2,"СÕÅ",'f',12,89,90,91}};
void main()
{
struct student *p;
int i;
printf("ѧºÅ ÐÕÃû ÐÔ±ð ÄêÁä ¸ßÊý ÎïÀí Ó¢Óï\n");
for(p = stu; p<stu+2; p++)
printf("%-5d %-8s %2c %4d %4d %4d %4d\n",p->num,p->name,p->sex,p->age);
for(i = 0;i<3;i++)
printf("%4d",p->score[i]);
}
结构体数组怎么分数 这段代码分数显示不正确 请问问题在哪
答案:1 悬赏:30 手机版
解决时间 2021-06-06 18:49
- 提问者网友:且恨且铭记
- 2021-06-06 15:15
最佳答案
- 五星知识达人网友:不想翻身的咸鱼
- 2021-06-06 16:40
#include<stdio.h>
struct student
{
int num;
char name[20];
char sex;
int age;
float score[3];
};
struct student stu[2] = {{1,"D?í?",'m',11,99,98,97},{2,"D???",'f',12,89,90,91}};
void main()
{
struct student *p;
int i;
printf("?§o? D??? D?±e ?êá? ??êy ??àí ó¢ó?\n");
for(p = stu; p<stu+2; p++)
{ printf("%-5d %-8s %2c %4d ",p->num,p->name,p->sex,p->age);
for(i = 0;i<3;i++)
printf("%4.f% ",p->score[i]);
printf("\n");
}
}
FOR语句这边加个括号,还有float 是用%f 的!
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯