学生信息管理系统(简单版)源代码

来源:网络收集 时间:2025-09-02 下载这篇文档 手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xuecool-com或QQ:370150219 处理(尽可能给您提供完整文档),感谢您的支持与谅解。点击这里给我发消息

简单的学生管理,运用链表、指针等

#include<stdio.h>
#include<stdlib.h>
#include<malloc.h>
#include<string.h>
#define NUll 0
#define LEN sizeof(struct student)
struct student
{
int number;
char name[10];
float score;
struct student *next;
};


/*函数说明*/
struct student * creat(); /*创建链表*/
void print(struct student *head); /*输出学生信息*/
struct student *add(struct student *head); /*添加学生信息*/
struct student * sort(struct student *head); /*对学生信息进行排序*/
struct student * insert(struct student *head); /*插入学生信息*/
struct student * del_num(struct student *head); /*删除学生信息*/
void search(struct student *head); /*查找学生信息*/
struct student * change(struct student *head); /*修改学生信息*/

int n;
int main()
{
int num,x;
char a[5];
struct student *head0,*head,*head1;
head=NUll;
A :
printf(" 学生信息系统 \n");
printf("1.建立链表\n");
printf("2.添加学生\n");
printf("3.插入学生\n");
printf("4.删除学生\n");
printf("5.查找学生\n");
printf("6.修改学生\n");
printf("7.数据浏览\n");
printf("0.退出程序\n");
printf("请选择操作(输入0—7):");
scanf("%d",&num);
switch(num)
{
case 1:
head=creat();
break;
case 2:
head=add(head);
head=sort(head);
print(head);
break;
case 3:
head1=insert(head);
head1=sort(head1);
print(head1);
break;
case 4:
head1=del_num(head);
print(head1);
break;
case 5:
search(head);
break;
case 6:
head1=change(head);
print(head1);
break;
case 7:
print(head);
break;
case 0:
return 0;
default :
printf("输入错误的数字!!请再输一次!\07\n");
}
goto A;
scanf("%d",&x);
return 0;
}


//创建链表
struct student * creat()
{
struct student *head,*p1,*p2;
n=0;
head=(struct student*)malloc(LEN);
if(head!=NULL)
{
printf("空链表已建立!\n");
}
else
{
printf("没有足够的内存空间!\07\n");
}
head->number=0;
strcpy(head->name,"");
head->score=0;
return head;


}

//输出学生信息
void print(struct student *head)
{
struct student *p;
if(head==NULL)
{
printf("未建立链表!!\n");
return;
}
p=head->next;
printf("\n所有学生信息的显示为:\n");
do
{
printf("学号:%d\t姓名:%s\t分数:%.2f\n",p->number,p->name,p->score);
p=p->next;
}while(p!=NUll);

}

//添加学生信息
struct student *add(struct student *head)
{
struct student *p1,*p2;
if(head==NULL)
{
printf("未建立链表!!\n");
retu
rn NULL;
}
p1=head;
while(1)
{
p2=(struct student *)malloc(LEN);
if(p2==NULL)
{
printf("没有足够的空间!\07\n");
return 0;
}
print

百度搜索“70edu”或“70教育网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,70教育网,提供经典教育范文学生信息管理系统(简单版)源代码在线全文阅读。

学生信息管理系统(简单版)源代码.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印 下载失败或者文档不完整,请联系客服人员解决!
本文链接:https://www.70edu.com/fanwen/1187292.html(转载请注明文章来源)

相关推荐:

Copyright © 2020-2025 70教育网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:370150219 邮箱:370150219@qq.com
苏ICP备16052595号-17
Top
× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:7 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:xuecool-com QQ:370150219