| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 328 人关注过本帖
标题:输入输出5个学生成绩的记录,输入不知道错在哪?
只看楼主 加入收藏
autumnyellow
Rank: 2
等 级:论坛游民
帖 子:72
专家分:75
注 册:2015-4-14
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:2 
输入输出5个学生成绩的记录,输入不知道错在哪?
#include<stdio.h>
#define N 5
struct student
{
    char num[6];
    char name[8];
    int score[4];
}stu[N];

int main ()
{
void input(struct student stu[]);
void print(struct student stu[]);
input(stu);
print(stu);


    return 0;
}

void input(struct student stu[])
{
    int i,j;
    for(i=0;i<N;i++);
    {
        printf("please input scores of student %d:\n",i+1);
        printf("\nNO.:");
        scanf_s("%s",stu[i].num);
        printf("name:");
        scanf("%s",stu[i].name);
        for(j=0;j<3;j++)
        {
            printf("score %d:",j+1);
            scanf("%d",&stu[i].score[j]);

        }
        printf("\n");

    }
}

void print(struct student stu[6])
{
    int i,j;
    printf("\nNO. name score1 score2 score3\n");
    for(i=0;i<N;i++)
    {
        printf("%5s%10s",stu[i].num,stu[i].name);
        for(j=0;j<3;j++)
        {
            printf("%9d",stu[i].score[j]);
        }
        printf("\n");

    }
}


/*输出:
please input scores of student 6:这个地方应该是1啊???

NO.:






搜索更多相关主题的帖子: scores return please include 记录 
2015-11-13 09:50
hellovfp
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:禁止访问
威 望:30
帖 子:2976
专家分:7697
注 册:2009-7-21
收藏
得分:20 
for(i=0;i<N;i++);

我们都在路上。。。。。
2015-11-13 10:13
autumnyellow
Rank: 2
等 级:论坛游民
帖 子:72
专家分:75
注 册:2015-4-14
收藏
得分:0 
谢谢
2015-11-13 12:09
快速回复:输入输出5个学生成绩的记录,输入不知道错在哪?
数据加载中...
 
   



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

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