| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 940 人关注过本帖
标题:c语言 顺序表 帮我完成下面的操作 实在不会写那
取消只看楼主 加入收藏
yangzhengmao
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2015-4-7
结帖率:0
收藏
已结贴  问题点数:20 回复次数:8 
c语言 顺序表 帮我完成下面的操作 实在不会写那
//结构体学生成绩管理系统
#include<stdio.h>
#include<string.h>
#define MAX 100  
//定义学生相关信息
struct stud
{
    int num ; //学号
    char name[10];  //姓名
    float yy;
    float sjk;
    float cyy;
    float avg;
    float pjf;
};
//结构体
  struct lxb
  {
      stud data[MAX];
      int len;
  };
//主函数
void main()
{
    lxb l;
    int k,i,n;
    l.len=0;
    do
    {
        printf("=====主菜单学生成绩管理系统=====\n");
        printf("       1.学生信息的录入\n");
        printf("       2.学生信息的统计\n");
        printf("       3.学生信息的显示\n");
        printf("       4.学生信息的查找\n");
        printf("       5.退出学生管理系统\n");
        printf("================================\n");
        printf("请输入选择(1-5)  ");
        scanf("%d",&n);
        if(n<=0||n>=5)
        {
            printf("系统正在退出,按任意键退出,谢谢!\n");
            break;
        }
        else
        {
            switch(n)
            {
              case 1:
                    while(1)
                    {
                      printf("想输入数据吗(-1退出) ");
                      scanf("%d",&k);
                      if(k==-1)
                      break;
                      else
                      {
                         printf("请输入学生相关信息(学号,姓名,英语,数据库,c语言)\n");
                         scanf("%d%s%f%f%f",&l.data[l.len].num,&l.data[l.len].name,&l.data[l.len].yy,&l.data[l.len].sjk,&l.data[l.len].cyy);
                         l.len++;
                      }
                    }
                    break;
              case 2:
                    int x;
                    do
                    {
                     printf("=====学生信息的统计=====\n");
                     printf("    1.学生成绩的总分\n");
                     printf("    2.学生成绩的平均分\n");
                     printf("    3.学生成绩的排序\n");
                     printf("    4.返回学生信息系统\n");
                     printf("========================\n");
                     printf("请输入选择(1-4)  ");
                     scanf("%d",&x);
                     if(x==4)
                     {
                         break;
                     }
                     else
                     {
                         switch(x)
                         {
                            case 1:
                                   printf("学号  姓名   英语    数据库  c语言   总分\n");
                                   for(i=0;i<l.len;i++)
                                   {
                                     l.data[i].avg=l.data[i].yy+l.data[i].sjk+l.data[i].cyy;
                                     printf("%2d%6s%8.0f%8.0f%8.0f%9.1f\n",l.data[i].num,l.data[i].name,l.data[i].yy,l.data[i].sjk,l.data[i].cyy,l.data[i].avg);
                                   }
                            break;
                            case 2:
                                printf("学号  姓名   英语    数据库  c语言   平均分\n");
                                for(i=0;i<l.len;i++)
                                {
                                  l.data[i].pjf=l.data[i].avg/3;
                                 printf("%2d%6s%8.0f%8.0f%8.0f%9.1f\n",l.data[i].num,l.data[i].name,l.data[i].yy,l.data[i].sjk,l.data[i].cyy,l.data[i].pjf);
                                }
                                break;
                            case 3:
                                int y;
                                do
                                {
                                     printf("========学生成绩的排序========\n");
                                    printf("     1.以总分排序(高到低)\n");
                                    printf("     2.以平均分排序(高到低)\n");
                                    printf("     3.返回学生信息统计\n");
                                    printf("==============================\n");
                                    printf(" 请输入选择(1--3)  ");
                                    scanf("%d",&y);
                                    if(y==3)
                                    {
                                        break;
                                    }
                                    else
                                    {
                                       switch(n)
                                       {
                                          case 1:
                                             break;
                                          case 2:
                                              break;
                                          case 3:
                                              break;
                                       }
                                    }
                                }while(1);
                                    break;
                         }
                     }
                    }while(1);
                    break;
              case 3:
                   printf("学号  姓名   英语    数据库  c语言   总分   平均分\n");
                      for(i=0;i<l.len;i++)
                   {
                     printf("%2d%6s%8.0f%8.0f%8.0f%9.1f%8.1f\n",l.data[i].num,l.data[i].name,l.data[i].yy,l.data[i].sjk,l.data[i].cyy,l.data[i].avg,l.data[i].pjf);
                   }
                   break;
              case 4:
                  int w;
                  do
                  {
                     printf("=======学生信息的查找=======\n");
                     printf("   1.总分最高的学生信息\n");
                     printf("   2.总分最低的学生信息\n");
                     printf("   3.平均分最高的学生信息\n");
                     printf("   4.平均分最低的学生信息\n");
                     printf("   5.任意查找某个学生的信息\n");
                     printf("   6.返回主菜单学生信息管理\n");
                     printf("==============================\n");
                     printf("请输入选择(1--6)   ");
                     scanf("%d",&w);
                     if(w==6)
                     {
                         break;
                     }
                     else
                     {
                         switch(w)
                         {
                              case 1:
                                  break;
                              case 2:
                                  break;
                              case 3:
                                  break;
                              case 4:
                                  break;
                              case 5:
                                  int q;
                                  do
                                  {
                                    printf("=====任意某个学生信息的查找=====\n");
                                    printf("         1.按学号查找\n");
                                    printf("         2.按姓名查找\n");
                                    printf("         3.返回信息查找\n");
                                    printf("================================\n");
                                    printf("  请输入选择(1----3)  ");
                                    scanf("%d",&q);
                                    if(q==3)
                                    {
                                        break;
                                    }
                                    else
                                    {
                                        int a=1;
                                        switch(q)
                                        {
                                            case 1:
                                                int xh;
                                                printf("请输入您要查找的学号(数字键0--9): ");
                                                scanf("%d",&xh);
                                                while(l.data[a-1].num!=xh&&a<=l.len)
                                                    a++;
                                                if(l.data[a-1].num==xh)
                                                {
                                                    l.data[a-1].avg=l.data[a-1].yy+l.data[a-1].sjk+l.data[a-1].cyy;
                                                    l.data[a-1].pjf=l.data[a-1].avg/3;
                                                    printf("学号  姓名   英语    数据库  c语言   总分   平均分\n");
                                                    printf("%2d%6s%8.0f%8.0f%8.0f%9.1f%8.1f\n",l.data[a-1].num,l.data[a-1].name,l.data[a-1].yy,l.data[a-1].sjk,l.data[a-1].cyy,l.data[a-1].avg,l.data[a-1].pjf);
                                                }
                                                else
                                                {
                                                    printf("系统里面没有录入改学生的信息\n");
                                                }
                                                break;
                                            case 2:
                                                int j=1;
                                                char n[10];
                                                printf("请输入您要查询的姓名: ");
                                                scanf("%s",&n);
                                                while(strcmp(l.data[j-1].name,n)&&j<=l.len)
                                                    j++;
                                                if(strcmp(l.data[j-1].name,n)==0)
                                                {
                                                    l.data[j-1].avg=l.data[j-1].yy+l.data[j-1].sjk+l.data[j-1].cyy;
                                                    l.data[j-1].pjf=l.data[j-1].avg/3;
                                                    printf("学号  姓名   英语    数据库  c语言   总分   平均分\n");
                                                    printf("%2d%6s%8.0f%8.0f%8.0f%9.1f%8.1f\n",l.data[j-1].num,l.data[j-1].name,l.data[j-1].yy,l.data[j-1].sjk,l.data[j-1].cyy,l.data[j-1].avg,l.data[j-1].pjf);
                                                }
                                                else
                                                {
                                                    printf("系统里面没有录入该学生信息\n");
                                                }
                                                break;
                                        }
                                    }
                                  }while(1);
                                  break;
                              case 6:
                                  break;
                         }
                     }
                  }while(1);
                  break;
            }
        }
    }while(1);
}
搜索更多相关主题的帖子: 信息 结构体 管理系统 c语言 include 
2015-04-07 09:48
yangzhengmao
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2015-4-7
收藏
得分:0 
  我就剩下 以总分排序和平均分排序   还有查找总分最高最低  和平均分最高最低那    帮帮忙
2015-04-07 09:55
yangzhengmao
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2015-4-7
收藏
得分:0 
专家们   快来看看   我是新手   写到这里实在是不会写那
2015-04-07 10:10
yangzhengmao
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2015-4-7
收藏
得分:0 
是我自己写的   现在上面的代码是可以运行的   就是还有几个功能不会写那   学得不精
2015-04-07 10:19
yangzhengmao
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2015-4-7
收藏
得分:0 
帮帮忙
2015-04-07 10:20
yangzhengmao
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2015-4-7
收藏
得分:0 
呵呵  不要说得那么绝对嘛
2015-04-07 10:27
yangzhengmao
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2015-4-7
收藏
得分:0 
困难就在  下面的代码是真的不会那   所以才叫专家们 帮帮忙嘛
2015-04-07 10:28
yangzhengmao
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2015-4-7
收藏
得分:0 
问题是以总分排序的都不会  怎么去写平均分    还有查找以总分最高的学生信息  也不会   帮帮忙 好不好
2015-04-07 11:29
yangzhengmao
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2015-4-7
收藏
得分:0 
图片附件: 游客没有浏览图片的权限,请 登录注册
调试出现这些问题   头痛    帮帮我
2015-04-07 21:50
快速回复:c语言 顺序表 帮我完成下面的操作 实在不会写那
数据加载中...
 
   



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

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