ex5-6.c

来自「这是《Keil Cx51 V7.0单片机高级语言编程与uVision2应用实践》」· C语言 代码 · 共 26 行

C
26
字号
    #include <stdio.h>
    main()  {
       struct mepoint  {
          unsigned char num;
          unsigned char name[11];
          float score;
        } mp[4]={
                 {1, "1stpoint", 368.78},
                 {2, "2ndpoint", 134.90},
                 {3, "3tdpoint", 798.90},
                 {4, "4thpoint", 436.01}
                };
        struct mepoint *p;
        unsigned char i,temp=0;
        float max;
        for (max=mp[0].score, i=1;i<4;i++)
          if (mp[i].score>max) {
            max=mp[i].score; temp=i;
          }
        p=mp+temp;
        printf("\nThe maxmum score: \n");
        printf("No.:   %bd\nname:  %s\nscore: %4.2f\n",
                p->num,p->name,p->score);
        while(1);
     }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?