Chinaunix首页 | 论坛 | 博客
  • 博客访问: 928952
  • 博文数量: 210
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 2070
  • 用 户 组: 普通用户
  • 注册时间: 2014-11-19 21:54
文章分类

全部博文(210)

文章存档

2020年(2)

2019年(18)

2018年(27)

2017年(5)

2016年(53)

2015年(88)

2014年(17)

分类: C/C++

2015-04-13 22:50:46

#include

struct score
{


    char name[20];


    char id[15];


    char class[500];


    float English;


    float Math;


float Network;


    float C;
};

int main ()


{


    struct score sc;


    printf ("Please input name \n");


    scanf("%s",sc.name);


    printf ("Please input id \n");


    scanf("%s",sc.id);


    printf ("Please input Math score \n");


    scanf("%f" , &sc.Math);


    printf ("Please input Network score  \n");


    scanf("%f", &sc.Network );


    printf ("Please input C ");


    scanf("%f", &sc.C );


       {
            if (sc.C>100||sc.C<0)


            {

                printf("your C score is wrong\n");

            }

        }


    printf ("Please input English score\n");


    scanf ("%f", &sc.English);
    {


        if (sc.English>100||sc.English<0)
        {
            printf("your English score is wrong\n");
            return 0;
        }
    }



    printf ("------------My score--------\n");


    printf ("Name          %s\n",sc.name );


    printf ("id               %s\n",sc.id);

    printf ("Class         %s\n",sc.class);


    printf ("English        \t\t   %0.1f\n",sc.English);


    printf ("Math           \t\t     %0.1f\n",sc.Math);


    printf ("Network        \t\t  %0.1f\n",sc.Network);


    printf ("C              \t\t      %0.1f\n",sc.C);


    printf("-----------------------------\n");

}


阅读(1528) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~