| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1888 人关注过本帖
标题:C语言学生管理系统
只看楼主 加入收藏
_0_0
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2016-4-21
收藏
 问题点数:0 回复次数:0 
C语言学生管理系统
这里面的按名字查找 和按总成绩排序怎么写  求指导

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define NUM 30
main()
{
    int i,j,num;
    int xue_hao1;
    char name1[30];
    int slt;   //此处变量表示选择
    int age[NUM]={17,18,16,17,15,19,16};   //年龄数组
    int xue_hao[NUM]={1,2,3,4,5,6,7};   //学号数组
    float chinese[NUM]={78.5,68,92,88.5,90,75,81};   //语文数组
    float math[NUM]={95,62,80,90.5,65.5,53,60};   //数学数组
    float english[NUM]={32,59,43,82,71,83,90};   //英语数组
    float sum[NUM]={205.5,207,222,261,226.5,213,231};   //总分数组
    float aver[NUM]={68.5,69,74,87,75.5,71,77};   //平均分数组
    float ping_shi[NUM]={81,80,92,98,95,89,88};   //平时成绩数组
    char sex[NUM]={'b','g','b','b','g','b','g'};   //性别数组
    char name[NUM][30]={"ran yi","zhang san","li si","wang wu","zhou er","xiao bai","xu san"};   //名字数组
    j=6;
    while(1)
    {
        system("cls");
        printf("=============★学生信息管理系统★=============\n");
        printf("                                              \n");
        printf("             1、退出程序;                     \n");
        printf("             2、查询个人学生信息;             \n");
        printf("             3、查询所有学生信息;             \n");
        printf("                                              \n");
        printf("=================制作组:3组==================\n");
        printf("                                              \n");
        printf("   请选择功能(1-3):");
        scanf("%d",&slt);
        switch(slt)
        {
        case 1:     //功能1-退出程序
           {
        system("cls");
        printf("========================================\n");
        printf("\n");
        printf("           ★谢谢您的使用!★            \n");
        printf("\n");
        printf("========================================\n");
        break;
        }
    case 2:    //功能2-查询个人学生信息
        {
        while(1)
        {
        system("cls");
        printf("=============★查询个人学生信息★=============\n");
        printf("                                              \n");
        printf("               1、按姓名查询;                 \n");
        printf("               2、按学号查询;                 \n");
        printf("               3、返回主菜单;                 \n");
        printf("                                              \n");
        printf("=================制作组:3组==================\n");
        printf("                                              \n");
        printf("   请选择功能(1-3):");
        scanf("%d",&slt);
        switch(slt)
        {
    case 1:   //功能1-按姓名查询
        {
        while(1)
        {
        system("cls");
        fflush(stdin);   //清除缓存
        printf("====================★按姓名查询★====================\n");
        printf("                                                      \n");
        printf("     请输入您要查询的姓名:");
        gets(name1);
            printf("                                                      \n");   
        for(i=0;i<NUM;i++)
        if(strcmp(name[i],name1)==0)
        {
           //输出学生信息
        printf("   姓名:%s\n",name[i]);
                printf("\n");
            printf("      性别:%c   ",sex[i]);
                printf("年龄:%d   ",age[i]);
                printf("学号:%d\n",xue_hao[i]);
                printf("\n");
            printf("      语文:%g   ",chinese[i]);
                printf("数学:%g   ",math[i]);
                printf("英语:%g\n",english[i]);
                printf("\n");
        printf("      总分:%g   ",sum[i]);
                printf("平均分:%g   ",aver[i]);
                printf("平时成绩:%g   \n",ping_shi[i]);
            }
        else
                  continue;
        printf("                                                      \n");
        printf("======================制作组:3组=====================\n");
        printf("                                                      \n");
        while(1)
        {
        printf("    1、继续查询   2、返回   请选择:");
            scanf("%d",&slt);
        if(slt==1||slt==2)
        break;
             }
            if(slt==2)
        break;
        }
        break;
        }
    case 2:   //功能2-按学号查询
        {
        while(1)
        {
        system("cls");
        printf("====================★按学号查询★====================\n");
        printf("                                                      \n");
            printf("     请输入您要查询的学号:");
        scanf("%d",&xue_hao1);
        printf("                                                      \n");
        for(i=0;i<NUM;i++)
        if(xue_hao1==xue_hao[i])
        {
             //输出学生信息
        printf("   姓名:%s\n",name[i]);
                printf("\n");
        printf("      性别:%c   ",sex[i]);
                printf("年龄:%d   ",age[i]);
                printf("学号:%d\n",xue_hao[i]);
                printf("\n");
        printf("      语文:%g   ",chinese[i]);
                printf("数学:%g   ",math[i]);
                printf("英语:%g\n",english[i]);
                printf("\n");
            printf("      总分:%g   ",sum[i]);
                printf("平均分:%g   ",aver[i]);
                printf("平时成绩:%g   \n",ping_shi[i]);
        }
        else
        continue;
        printf("                                                      \n");
        printf("======================制作组:3组=====================\n");
        printf("                                                      \n");
        while(1)
        {
        printf("    1、继续查询   2、返回   请选择:");
        scanf("%d",&slt);
        if(slt==1||slt==2)
        break;
        }
        if(slt==2)
        break;
        }
        break;
        }
    case 3:   //功能3-返回主菜单
        break;
        }
            if(slt==3)  //当选择功能3时,进行判断,跳出循环
        break;
        }
        break;
        }
       case 3:
        {
        while(1)
        {
        num=1;
        system("cls");
          printf("========================================================★查询所有学生信息★========================================================\n");
    printf("                                                                                                                              \n");
    for(i=0;i<=j;i++)
    {
    printf(" %d、  姓名:%s   ",num,name[i]);
        printf("性别:%c   ",sex[i]);
        printf("年龄:%d   ",age[i]);
    printf("学号:%d   ",xue_hao[i]);
        printf("语文:%g   ",chinese[i]);
        printf("数学:%g   ",math[i]);
    printf("英语:%g   ",english[i]);
        printf("总分:%g   ",sum[i]);
        printf("平均分:%g   ",aver[i]);      //输出已有的学生信息
    printf("平时成绩:%g   \n",ping_shi[i]);
    printf("\n");
    num++;
    }
        printf("============================================================制作组:3组=============================================================\n");
    printf("                                                                                                                              \n");
    printf("              1、添加信息     2、修改信息     3、删除信息     4、排序     5、返回主菜单     请选择(1-5):");
    scanf("%d",&slt);
    switch(slt)
    {
case 1:   //功能1-添加信息
        {        
        break;
    }
case 2:   //功能2-修改信息
    {
    break;
    }
case 3:   //功能3-删除信息
    {
    break;
    }
case 4:   //功能4-排序
    {
    while(1)
    {
    system("cls");
    printf("====================★排序★====================\n");
    printf("                                                \n");
        printf("                 1、返回;                       \n");
    printf("                 2、按学号排序;                 \n");
    printf("                 3、按总成绩排序;               \n");
        printf("                 4、按平均成绩排序;             \n");
    printf("                 5、按字符串大小排序;           \n");
    printf("                                                \n");
    printf("===================制作组:3组==================\n");
    printf("                                                \n");
        printf("     请选择(1-5):");
        scanf("%d",&slt);
    switch(slt)
    {
case 1:
    break;
case 2:
    {
    break;
    }
case 3:
    {
    break;
    }
case 4:
    {
    break;
    }
case 5:
    {
    break;
    }
    }
    if(slt==1)
    break;
    }
    break;
    }
case 5:   //功能5-返回主菜单
    break;
    }
    if(slt==5)       //当选择功能5时,进行判断,跳出循环
    break;
    }
    break;
    }
        }
    if(slt==1)  //当选择功能1时,进行判断,跳出循环结束程序
        break;
    }
}
搜索更多相关主题的帖子: 管理系统 english include C语言 总成绩 
2016-04-21 13:59
快速回复:C语言学生管理系统
数据加载中...
 
   



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

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