标题:求助各位大佬:
只看楼主
编程小白555
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2017-10-10
 问题点数:0 回复次数:1 
求助各位大佬:
#include <stdio.h>
#include <stdlib.h>

struct student
{
  int num;
  char name[10];
  float score[3];
};
int main()
{
    void input(struct student stu[5]);
    void print(struct student *s);
    struct student stu[5];
    struct student *p;
    p=stu;
    printf("input data:\n");
    input(stu);
    printf("output data:\n");
    print(p);
    return 0;
}
void input(struct student stu[5])
{
    int i;
    for(i=0;i<5;i++)
    {
        scanf("%d%s%f%f%f\n",&stu[i].num,stu[i].name,&stu[i].score[0],&stu[i].score[1],&stu[i].score[2]);
    }

}
void print(struct student *s)
{
    int i;
    for(i=0;i<5;i++,s++)
    {
        printf("%-5d %-10s %.2f %.2f %.2f\n",s->num,s->name,s->score[0],s->score[1],s->score[2]);
    }

}

为什么调用了print函数,不能输出呢?只能执行输入
搜索更多相关主题的帖子: struct student stu score void 
2017-10-20 20:52
吹水佬
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:432
帖 子:10064
专家分:41463
注 册:2014-5-20
得分:0 
//scanf("%d%s%f%f%f\n",.....
scanf("%d%s%f%f%f",......
2017-10-21 05:21



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-481607-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.812965 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved