| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 452 人关注过本帖
标题:网上编译系统提示的错误?求解?
只看楼主 加入收藏
过五矿
Rank: 1
等 级:新手上路
帖 子:22
专家分:0
注 册:2015-10-29
结帖率:57.14%
收藏
已结贴  问题点数:20 回复次数:5 
网上编译系统提示的错误?求解?
图片附件: 游客没有浏览图片的权限,请 登录注册


#include <stdio.h>
#include <stdlib.h>
#include<string.h>
struct Student{
        int ID;
        int class;
        char name[10];
        float score[3];
        float sum;
        }stu[3];
int id1;  //标记删除的学生学号

void print(void)
        {
            printf("1.input\n");
            printf("2.delete\n");
            printf("3.select\n");
            printf("4.order\n");
            printf("5.output\n");
            printf("6.quit\n");
            printf("please input your option\n");
        }

void input(struct Student stu[],int j)  //用来输入数据的函数,当用户输入1时,执行此函数。
    {
        char ch[10],ch1[10]={"yes"},ch2[10]={"no"};
        printf("id ");
        scanf("%d",&stu[j].ID);
        printf("class ");
        scanf("%d",&stu[j].class);
        printf("name ");
        scanf("%s",stu[j].name);
        printf("score1 ");
        scanf("%f",&stu[j].score[0]);
        printf("score2 ");
        scanf("%f",&stu[j].score[1]);
        printf("score3 ");
        scanf("%f",&stu[j].score[2]);
        stu[j].sum=stu[j].score[0]+stu[j].score[1]+stu[j].score[2];

        printf("continue?");
        scanf("%s",ch);
        if(strcmp(ch,ch1)==0)
        {
            j++;
            input(stu,j);
        }
        if(strcmp(ch,ch2)==0)
         print();
   }

int delete(struct Student stu[])  //当用户输入数字2时,操作此函数,进行学生数据的删除
    {
        char ch1[10]={"yes"},ch2[10]={"no"},ch3[10];
        int i,j;
        scanf("%d",&id1);
        for(i=0;i<3;i++)
        {
           if(id1!=stu[i].ID)
           {
               printf("%d,%d,%s,",stu[i].ID,stu[i].class,stu[i].name);
               for(j=0;j<3;j++)
               {printf("%.1f,",stu[i].score[j]); }
               printf("%.1f\n",stu[i].sum);
           }
        }
         printf("continue?");
         scanf("%s",ch3);
         return id1;
         if(strcmp(ch3,ch1)==0) delete(stu);
        if(strcmp(ch3,ch2)==0) print();
   }

void select(struct Student stu[])    //当用户输入数字3时,运行这个函数
    {
        char ch[10],ch1[10]={"yes"},ch2[10]={"no"},ch3[10];
        int id,cla,i,j,flag=0;
        scanf("%d",&id);
        for(i=0;i<3;i++)
        {
           if(id==stu[i].ID)
           {
               printf("%d,%d,%s,",stu[i].ID,stu[i].class,stu[i].name);
               for(j=0;j<3;j++)
                   {printf("%.1f,",stu[i].score[j]);}
               printf("%.1f\n",stu[i].sum);
               flag++;
           }
        }
        if(flag==0) printf("there is no eligible student");
        printf("continue?");
        scanf("%s",ch);
        if(strcmp(ch,ch1)==0)
       {
            scanf("%d",&cla);
             for(i=0;i<3;i++)
              {
                if(cla==stu[i].class)
                  {
                     printf("%d,%d,%s,",stu[i].ID,stu[i].class,stu[i].name);
                       for(j=0;j<3;j++)
                        {printf("%.1f,",stu[i].score[j]);}
                     printf("%.1f\n",stu[i].sum);
                  }
             }
       }
       printf("continue?");
       scanf("%s",ch3);
       if(strcmp(ch3,ch2)==0) print();
 }

void order(struct Student stu[])   //当用户输入4时,进行此函数,进行排序
    {
        int i,j;
        struct Student temp;
       for(i=0;i<2;i++)
            for(j=0;j<2-i;j++)
               {
                    if(stu[i].ID!=id1)
                      {
                        if(stu[j].class>stu[j+1].class)
                            {temp=stu[j];stu[j]=stu[j+1];stu[j+1]=temp;}
                        if(stu[j].class==stu[j+1].class)
                            {
                               if(stu[j].sum>stu[j+1].sum)
                                  {temp=stu[j];stu[j]=stu[j+1];stu[j+1]=temp;}
                            }
                      }
               }
        for(i=0;i<3;i++)
               {
                   if(stu[i].ID!=id1)
                      {
                          printf("%d,%d,%s,",stu[i].ID,stu[i].class,stu[i].name);
                          for(j=0;j<3;j++)
                              {printf("%.1f,",stu[i].score[j]);}
                          printf("%.1f\n",stu[i].sum);
                      }
              }
             print();
}

void output(struct Student stu[])  //当用户输入5时,进行数据的输出。
      {
         int i,j;
        for(i=0;i<3;i++)
           {
                if(stu[i].ID!=id1)
                   {
                      printf("%d,%d,%s,",stu[i].ID,stu[i].class,stu[i].name);
                       for(j=0;j<3;j++)
                          {printf("%.1f,",stu[i].score[j]);}
                      printf("%.1f\n",stu[i].sum);
                   }
          }
        print();
      }

void match(int n)  //将用户输入的数字与函数进行搭配
    {
        switch(n)
          {
              case 1:input(stu,0); break;
              case 2:delete(stu);break;
              case 3:select(stu);break;
              case 4:order(stu);break;
              case 5:output(stu);break;
              case 6:break;
          }
    }

int main()
        {
            int a[6];         //用数组存储这输入的数字,并进行搭配。
            print();
            scanf("%d",&a[0]);
            if(a[0]!=6)
             { match(a[0]);
               scanf("%d",&a[1]);
                 if(a[1]!=6)
                      {match(a[1]);
                       scanf("%d",&a[2]);
                       if(a[2]!=6)
                           {match(a[2]);
                              scanf("%d",&a[3]);
                                if(a[3]!=6)
                                   {match(a[3]);
                                     scanf("%d",&a[4]);
                                       if(a[4]!=6)
                                          {match(a[4]);
                                            scanf("%d",&a[5]);
                                             if(a[5]!=6)
                                             {match(a[5]);}
                                          }
                                   }
                             }

                         }
             }
            return 0;
      }





搜索更多相关主题的帖子: include 网上 
2015-11-12 22:26
rjsp
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:528
帖 子:9024
专家分:54030
注 册:2011-1-18
收藏
得分:7 
select换个名字
2015-11-13 00:06
过五矿
Rank: 1
等 级:新手上路
帖 子:22
专家分:0
注 册:2015-10-29
收藏
得分:0 
回复 2楼 rjsp
换了后对了,可是为什么呢???
2015-11-13 12:55
wp231957
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:神界
等 级:贵宾
威 望:423
帖 子:13688
专家分:53332
注 册:2012-10-18
收藏
得分:7 
关键字???

DO IT YOURSELF !
2015-11-13 14:21
embed_xuel
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
等 级:贵宾
威 望:58
帖 子:3845
专家分:11385
注 册:2011-9-13
收藏
得分:7 
select,socket协议族

总有那身价贱的人给作业贴回复完整的代码
2015-11-13 15:05
过五矿
Rank: 1
等 级:新手上路
帖 子:22
专家分:0
注 册:2015-10-29
收藏
得分:0 
谢谢
2015-11-15 11:37
快速回复:网上编译系统提示的错误?求解?
数据加载中...
 
   



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

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