| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 3562 人关注过本帖
标题:版主,我还是改了啊!可是还是不对啊?
只看楼主 加入收藏
AQ2130062
Rank: 1
来 自:浙江宁波
等 级:新手上路
帖 子:5
专家分:0
注 册:2016-5-9
结帖率:100%
收藏
 问题点数:0 回复次数:1 
版主,我还是改了啊!可是还是不对啊?
score *creatlink()
 {
     score*head;
     score *pl,*p2,*p3,*max;
     int i,j;
     float fen;
     char t[10];
     n=0;
     p1=p2=p3=(score *)malloc(LEN);head=p3;
     printf("请输入学生资料, 输0退出!\n");
 repeat1: printf("请输入学生学号(学号应大于0): ");
          scanf("%d",&p1->number);
          while(p1->number<0)
          {
              getchar();
              printf("输入错误,新重新输入学生学号:");
                  scanf("%d",&p1->number):}
          if(p1->number==0)
              goto end;
          else
          {
              p3=head;
              if(n>0)
              {for(i=0;i<n;i++)
              {if(p1->number!=p3->number)
              p3=p3->next;
              else
              {printf("学号重复,请重输!\n");
              goto repeat1;
              }
              }
              }
          }
          printf("请输入学生姓名: ");
              scanf("%s",&p1->name);
              printf("请输入语文成绩(0~100): ");
              scanf("%f",&p1->chinese);
              while(p1->chinese<0||p1->chinese>100)
              {
                  gerchar();
                  printf("输入错误, 请重新输入语文成绩");
                  scanf("%f",&p1->chinese);}
              printf("请输入数学成绩(0~100): ");
              scanf("%f",&p1->mathmatic);
              while(p1->mathmatic<0||p1->mathmatic>100)
              {
                  getchar();
                  printf("输入错误, 请重新输入数学成绩");
                  scanf("%f",&p1->mathmatic);}
              printf("请输入英语成绩(0~100): ");
              scanf("%f",&p1->english);
              while(p1->english<0||p1->english>100)
              {
                  getchar();
                  printf("输入错误, 请重新输入英语成绩");
                  scanf("%f",&p1->english);}
              head=NULL;
              while(p1->number!=0)
              {
                  n=n+1;
                  if(n==1)
                      head=p1;
                  else
                      p2->next=p1;
                  p2=p1;
                  p1=(score *)malloc(LEN);
                      printf("请输入学生资料, 输0退出!\n");
 repeat2:printf("请输入学生学号(学号应大于0): ");
         scanf("%d",&p1->number);
         while(p1->number<0)
         {
             getchar();
             printf("输入错误,请重新输入学生学号:");
             scanf("%d",&p1->number);}
         if(p1->number==0)
             goto end;
         else
         {
             p3=head;
             if(n>0)
             {for(i=0;i<n;i++)
             {if(p1->number!=p3->number)
             p3=p3->next;
             else
             {
                 printf("学号重复,请重输!\n");
                 goto repeat2;
             }
             }
             }
         }
         printf("请输入学生姓名: ");
         scanf("%s",&p1->name);
         printf("请输入语文成绩(0~100): ");
         scanf("%f",&p1->chinese);
         while(p1->chinese<0||p1->chinese>100)
         {
         getchar();
             printf("输入错误, 请重新输入语文成绩");
             scanf("%f",&p1->chinese);}
             printf("请输入数学成绩(0~100): ");
             scanf("%f",&p1->mathmatic);
             while(p1->mathmatic<0||p1->mathmatic>100)
             {
                 getchar();
                 printf("输入错误, 请重新输入数学成绩");
                 scanf("%f",&p1->mathmatic);}
                 printf("请输入英语成绩(0~100): ");
                 scanf("%f",&p1->english);
                 while(p1->english<0||p1->english>100)
                 {getchar();
                 printf("输入错误, 请重新输入英语成绩");
         scanf("%f",&p1->english);}
              }
 end: p1=head;
      p3=p1;
      for(i=1;i<n;i++)
      {
          for(j=i+1;j<=n;j++)
          {
              max=p1;
              p1=p1->next;
              if(max->number>p1->number)
                  {
                  k=max->number;
                  max->number=p1->number;
                  p1->number=k;
                  strcpy(t,max->name);
                  strcpy(max->name,p1->name);
                  strcpy(p1->name,t);
                  fen=max->chinese;
                  max->chinese=p1->chinese;
                  p1->chinese=fen;
                  fen=max->mathmatic;
                  max->mathmatic=p1->mathmatic;
                  p1->mathmatic=fen;
                  fen=max->english;
                  max->english=p1->english;
                  p1->english=fen;
              }
          }
          max=head;p1=head;
      }
      p2->next=NULL;
      printf("输入的学生数为:%d个!\n",n);
      return(head);
      }
搜索更多相关主题的帖子: number 资料 
2016-05-12 22:23
AQ2130062
Rank: 1
来 自:浙江宁波
等 级:新手上路
帖 子:5
专家分:0
注 册:2016-5-9
收藏
得分:0 
求指教啊

我真的很帅
2016-05-14 22:36
快速回复:版主,我还是改了啊!可是还是不对啊?
数据加载中...
 
   



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

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