3

作者在 2009-03-08 17:47:27 发布以下内容
#include "stdio.h"


main()
{
type struct  Student{
  char name[20];
  float qmcj;
  float bjcj;
  char  xsgb;
  char xbxs;
  float lw;
  float money;
}
    int n,i;
    float maxmoney,max;
    char *maxname;
    max=0;
    maxmoney=0;
    scanf("%d"\n,&n);
    Student st[n];
    for(i=0;i<n;i++)
    {
       scanf("%c %f %f %c %c %f ",&st[i].name,&st[i].qmcj,&st[i].bjbj,&st[i].xbxs,&st[i].zb,&st[i].lw);
       if(qmcj>80&&lw>=1)
       {
         st[i].money=st[i].money+8000;
       }
       if(qmcj>80&&bjcj>80)
       {
        st[i].money=st[i].money+4000;
       }
       if(qmcj>90)
       {
        st[i].money=st[i].mone+2000;
       }
       if(xbsx==Y&&qmcj>85)
       {
        st[i].money=st[i].money+1000;
       }
       if(xsgb==Y)
       {
        st[i].money=st[i].money+850;
       }
       if(max<st[i].money)
       {
        max=st[i].money;
        maxname=&st[i].name;
       }
       maxmoney=maxmoney+st[i].money;
    }
    printf("%c"/n,maxname);
    printf("%f"/n,max);
    printf("%f"/n,maxmoney);
}
\\
#include "stdio.h"

main()
{
    typedef struct  
    {
        char name[20];
        float qmcj;
        float bjcj;
        char  xsgb;
        char xbxs;
        float lw;
        float money;
    }Student;

    int n=4,i;
    float maxmoney,max;
    char *maxname;
    Student st[100];
    
    max=0;
    maxmoney=0;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
      scanf("%s %f %f %c %c %f",st[i].name,&st[i].qmcj,&st[i].bjcj,&st[i].xsgb,&st[i].xbxs,&st[i].lw);
      getchar();
        st[i].money=0;
       if(st[i].qmcj>80 && st[i].lw>=1)
       {
         st[i].money=8000;
       }
       if(st[i].qmcj>85 && st[i].bjcj>80)
       {
        st[i].money=st[i].money+4000;
       }
       if(st[i].qmcj>90)
       {
        st[i].money=st[i].money+2000;
       }
       if(st[i].xbxs=='Y' && st[i].qmcj>85)
       {
        st[i].money=st[i].money+1000;
       }
       if(st[i].xsgb=='Y')
       {
        st[i].money=st[i].money+850;
       }
       if(max<st[i].money)
       {
        max=st[i].money;
        maxname=st[i].name;
       }
       maxmoney=maxmoney+st[i].money;
    }
    printf("%s\n",maxname);
    printf("%.0f\n",max);
    printf("%.0f\n",maxmoney);
}
默认分类 | 阅读 1137 次
文章评论,共3条
flamemiracle
2009-03-08 22:07
1
在我机子上运行怎么这么多错啊
独伊(作者)
2009-03-09 21:23
2
<div class="quote"><span class="q"><b>flamemiracle</b>: 在我机子上运行怎么这么多错啊</span></div>呵呵,我还没来得及运行,我也是收藏别人写的呢。
flamemiracle
2009-03-10 12:42
3
<div class="quote"><span class="q"><b>独伊</b>: 呵呵,我还没来得及运行,我也是收藏别人写的呢。</span></div>这样啊
游客请输入验证码
浏览27296次
文章分类