标题:error C2078: too many initializers怎么弄
只看楼主
domore
Rank: 1
等 级:新手上路
帖 子:26
专家分:0
注 册:2019-7-25
结帖率:60%
已结贴  问题点数:4 回复次数:2 
error C2078: too many initializers怎么弄

#include<stdio.h>
struct Student
    {
    int num;
    char name[20];
    float score;
    };

int main()
    {
    struct Student stu[5]=
        {
        {10010,"Li",80},
        {10015,"Po",90,
        {10020,"Wu",76},
        {10034,"Qi",79},
        {10056,"Zhang",89}
        };
    struct Student temp;
    const int n=5;
    int i,j;
    printf("the order is:\n");
    for(i=0;i<n-1;i++)
        for(j=i+1;j<n;j++)
            if(stu[j].score>stu[i].score)
                {
                temp=stu[i];
                stu[i]=stu[j];
                stu[j]=temp;
                }
    for(i=0;i<n;i++)
        printf("%6d %8s %6.2f\n",stu[i].num,stu[i].name,stu[i].score);
    return 0;
    }
搜索更多相关主题的帖子: stu Student int score for 
2019-08-14 08:26
rjsp
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:507
帖 子:8890
专家分:53117
注 册:2011-1-18
得分:2 
{10015,"Po",90,
改为
{10015,"Po",90},
2019-08-14 08:29
自学的数学
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:贵宾
威 望:46
帖 子:967
专家分:4146
注 册:2017-11-15
得分:2 
2019-08-14 21:54



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




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

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