学生成绩查询系统用c语言,求学生学籍及成绩查询系统要用c语言做的,会做的帮个忙啊 爱问知识人...

自己看看吧。这是数据结构编程的实例。自己琢磨吧。

#include //预处理

#include

#include

#include

#define OK 1

#define null 0

#define error 0

typedef int status;

typedef struct student

{

char studentname[10]; //姓名//

int studentnumber; //学号//

int age; //年龄//

float chinesescore; //语文成绩//

float mathsscore; //数学成绩//

float englishscore; //英语成绩//

}elemtype;

typedef struct

{

elemtype *elemstudent; //学生数组首地址//

int studentlength; //学生数组实际长度//

int max; //数组最大值//

}sqlist;

status initlist_sq(sqlist&L) //生成空顺序表//

{

L。

elemstudent=(elemtype*)malloc(10*sizeof(elemtype));

if(!L。elemstudent)

{

printf("

空间未申请到");

exit(0);

}

L。

studentlength=0;

L。max=10;

return OK;

}

status datain_sq(sqlist&L,int stunums) //向表中输入学生数据//

{

int i;

for(i=0;iL。

studentlength)

{printf("

插入位置错误");

return error;

}

q=&(L。elemstudent[i-1]);

for(p=&(L。

elemstudent[L。studentlength-1]);p>=q;p--)

{

*(p 1)=*p;

*q=x;

L。studentlength ;

}

return OK;

}

status listsearch_age(sqlist&L,int age1,int age2) //按年龄查找//

{

int i,temp=0;

printf("

姓名学号年龄语文数学英语

");

for(i=0;i=age1&&L。

elemstudent[i]。age=pivotkey)

--high;

L。elemstudent[low]=L。elemstudent[high];

while(low=pivotkey)

--high;

L。

elemstudent[low]=L。elemstudent[high];

while(low low;

L。

elemstudent[high]=L。elemstudent[low];

}

L。elemstudent[low]=L。elemstudent[0];

return low;

}

void qsort(sqlist&L,int low,int high)

{

int pivotloc;

if(low{

pivotloc=partition(L,low,high);

qsort(L,low,pivotloc-1);

qsort(L,pivotloc 1,high);

}

}

void quicksort(sqlist&L) //快速排序//

{

int i;

qsort(L,1,L。

studentlength);

printf("

姓名学号年龄语文数学英语

");

for(i=0;iprintf("

%s%d%d%。

2f%。2f%。2f

",L。elemstudent[i]。studentname,L。elemstudent[i]。studentnumber,L。elemstudent[i]。age,L。elemstudent[i]。chinesescore,L。

elemstudent[i]。mathsscore,L。elemstudent[i]。englishscore);

}

void main() //主函数//

{

int age1,age2,y,number,e1,e2;

int low,high;

elemtype x;

sqlist myL;

char sname[10];

initlist_sq(myL);

printf("

●●● 录入学生信息 ●●●

");

printf("

您想读入几个学生数据");

scanf("%d",&y);

datain_sq(myL,y);

A: printf("◇◇◇ 主界面 ◇◇◇ ");

printf("

************************************

");

printf("* 学生成绩信息管理系统 *

");

printf("* 作者:安园园 *

");

printf("* *

");

printf("*1学生成绩浏览表 2查询学生信息 *

");

printf("* *

");

printf("*3插入学生信息 4排序学生信息 *

");

printf("* *

");

printf("*5退学管理 6退出主界面 *

");

printf("* *

");

printf("************************************

");

b: printf("

请输入你的选择:

");

scanf("%d",&y);

switch(y)

{case 1:

printf("

我校学生信息表浏览表如下

");

dataout_sq(myL);

break;

case 2:

c:printf("

◇◇◇ 查找子界面 ◇◇◇

");

printf("*******************************

");

printf("* 1按姓名查找 2按年龄查找 *

");

printf("* *

");

printf("* *

");

printf("* 3按学号查找 4返回主界面 *

");

printf("*******************************

");

printf("

请输入你要查找的标准:

");

scanf("%d",&y);

switch(y)

{case 1:

printf("

请输入您要查找的学生姓名");

scanf("%s",sname);

printf("

要查找的学生信息为:");

listsearch_name(myL,sname);

break;

case 2:

printf("

请输入您要查找的年龄范围");

scanf("%d %d",&age1,&age2);

printf("

要查找的学生信息为:");

listsearch_age(myL,age1,age2);

break;

case 3:

printf("

请输入您要查找的学生学号");

scanf("%d",&number);

printf("

要查找的学生信息为:");

listsearch_number(myL,number);

break;

case 4:goto A;

}

goto c;

break;

case 3:

printf("

请输入要插入的学生信息");

printf("

姓名 学号 年龄 语文 数学 英语

");

scanf("%s %d %d %f %f %f",x。

studentname,&x。studentnumber,&x。age,&x。chinesescore,&x。mathsscore,&x。

englishscore);

printf("请输入您要插入的位置:

");

scanf("%d",&y);

listinsert_sq(myL,y,x);

dataout_sq(myL);

break;

case 4:

printf("

◇◇◇ 排序子界面 ◇◇◇

");

printf("*******************************

");

printf("* 1按学号浏览 *

");

printf("* *

");

printf("* 2按年龄浏览 *

");

printf("* *

");

printf("* 3返回主界面 *

");

printf("*******************************

");

printf("请输入您选择排序的标准:

");

scanf("%d",&y);

switch(y)

{case 1:

printf("

请输入两个指针的初值:

");

printf("e1:");

scanf("%d",&e1);

printf("e2:");

scanf("%d",&e2);

partition1(myL,e1,e2);

qsort1(myL,e1,e2);

printf("

按学号浏览学生信息如下:

");

quicksort1(myL);

break;

case 2:

printf("

请输入两个指针的初值:

");

printf("e1:");

scanf("%d",&e1);

printf("e2:");

scanf("%d",&e2);

partition(myL,e1,e2);

qsort(myL,e1,e2);

printf("

按学生年龄浏览学生信息如下:

");

quicksort(myL);

break;

case 3: goto A;

}

goto b;

break;

case 5:

printf("请输入要退学的同学序号和姓名:

");

listdelete_sq(myL,y,x);

dataout_sq(myL);

break;

case 6:exit(0);

}

goto b;

}。

全部

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值