c语言对结构体排序中间变量,求助:c语言怎么实现结构体的排序? 总是弄不对啊...
发布日期:2021-06-24 11:47:23 浏览次数:3 分类:技术文章

本文共 2042 字,大约阅读时间需要 6 分钟。

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

#include

#include

#include

#define t 200

void fun(struct student *s);

void fun1(struct student *s);

void fun2(struct student *s);

void fun3(struct student *s);

void fun4(struct student *s);

typedef struct student

{

char no[20];

char name[20];

char spec[20];

int CLASS;

char sex[20];

float score[20];

}student;

void main()

{

student s[t]={

{"0001","张","机自",111,"男",80.6},

{"0002","王","机自",111,"女",75.5},

{"0003","朱","机自",112,"女",82.5},

{"0004","雷","机自",114,"男",75.6},

{"0005","马","土木",112,"男",90.5},

{"0006","李","包装",115,"男",65.0},

{"0007","赵","水利",111,"男",55.0},

{"0008","余","水利",112,"女",70.5},

{"0009","孙","水利",113,"男",80.0},

{"0010","吕","水文",111,"男",52.0},

{"0011","杨","造价",113,"男",95.0},

{"0012","宋","应化",112,"男",92.5},

{"0013","刘","造价",111,"男",66.0},

{"0014","柳","造价",113,"女",80.0},

{"0015","阙","测控",114,"男",73.5},

{"0016","周","交运",112,"男",87.5},

{"0017","郑","物流",115,"女",50.5},

{"0018","蒋","冶金",111,"女",79.5},

{"0019","钱","冶金",113,"男",95.5},

{"0020","冒","自动化",112,"男",59.0}};

fun(s);

}

void fun(student *s)

{

int n;

printf("\n\n\t\t学生档案管理系统");

printf("\n\n\t----------------------------------------");

printf("\n\n\t\t1:录入学生信息系统");

printf("\n\n\t\t2:查询学生信息系统");

printf("\n\n\t\t3:输出学生信息系统");

printf("\n\n\t\t4:退出系统");

printf("\n\n\t----------------------------------------");

printf("\n\n请选择你要的服务(按数字1~4进入):");

scanf("%d",&n);

system("cls");

if(n==1)

{

printf("\n\n\t\t欢迎进入录入学生系统");

fun1(s);

}

else if(n==2)

{

printf("\n\n\t\t\t欢迎进入查询学生系统");

printf("\n\n\t----------------------------------------");

printf("\n\n\t\t1:按学号查询学生信息系统");

printf("\n\n\t\t2:按姓名查询学生信息系统");

printf("\n\n\t----------------------------------------");

printf("\n\n请选择你要的服务(按数字1~2进入):");

scanf("%d",&n);

system("cls");

if(n==1)

{

printf("\n\n\t\t1:按学号查询学生信息系统");

fun2(s);

}

else if(n==2)

{

printf("\n\n\t\t1:按姓名查询学生信息系统");

fun3(s);

}

else

{

printf("\n\n\t\t数据错误");

}

}

else if(n==3)

{

printf("\n\n\t\t\t欢迎进入输出学生系统");

fun4(s); }

else if(n==4)

{

printf("\n\n\t\t谢谢使用学生管理系统!\n");

printf("\n\n\t\t请双击Enter键退出系统:");

getchar();

getchar();

exit(0);

}

转载地址:https://blog.csdn.net/weixin_32570803/article/details/117150983 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:c语言宏定义只能在最前面吗,C语言宏定义注意事项
下一篇:分糖果游戏c语言程序设计,C语言实例 10个小孩分糖果

发表评论

最新留言

路过按个爪印,很不错,赞一个!
[***.219.124.196]2024年04月21日 06时18分16秒