资源简介
应用c语言完成了学生学籍管理系统。包括对学生信息的增删改查。系统特别完整。
代码片段和文件信息
#include
#include
#include
#define SIZE 100
typedef struct student
{
int data;
int num;
struct student *next;
}node*pnode;
pnode Creat_list();//新建链表
pnode Insert_list(pnode head);//插入链表
void Trave_list(pnode head);//遍历链表
pnode Delete_list(pnode head);//删除链表
pnode Sort_list(pnode head);//链表排序
pnode Rework_list(pnode head);//修改数据
void Len_list(pnode head);//链表的长度
void fsearch(pnode head);//查找数据
void writefile( pnode head);//写入文件
void readfile();//从文件中读出
void writefile( pnode head)
{
FILE *fp;
pnode p;
int i=0;
p=(pnode)malloc(sizeof(node));
fp=fopen(“2.txt““w+“);
p=head->next;
while(p!=NULL)
{
fprintf(fp“num=%2ddata=%2d\n“p->nump->data);
p=p->next;
i++;
}
fclose(fp);
}
void readfile()
{
FILE *fp;
char ch;
fp=fopen(“2.txt““r“);
rewind(fp);
while(!(feof(fp)))
{
ch=fgetc(fp);
putchar(ch);
}
}
pnode Creat_list()
{
int leni;
pnode pheadptr;
head=(pnode)malloc(sizeof(node));
ptr=head;
printf(“Please input the numbers how many you want len=“);
scanf(“%d“&len);
for(i=0;i {
p=(pnode)malloc(sizeof(node));
printf(“Please input the num you want num=“);
scanf(“%d“&p->num);
printf(“data=“);
scanf(“%d“&p->data);
ptr->next=p;
p->next=NULL;
ptr=ptr->next;
}
return head;
}
void Trave_list(pnode head)
{
pnode p=head->next;
printf(“The following is the students‘information\n“);
while(p!=NULL)
{
printf(“num=%5ddata=%5d\n“p->nump->data);
p=p->next;
}
}
pnode Insert_list(pnode head)
{
int numi=1 j=0d=-1;
pnode ptr=head->next;
pnode p=(pnode)malloc(sizeof(node));
printf(“Please input the num what you want to insert before:num=“);
scanf(“%d“&num);
while(ptr)
{
j++;
if(ptr->num==num)
{
int d=num;
printf(“have found the num\n“);
break;
}
else
ptr=ptr->next;
}
if(num==d)
printf(“j=%5d\n“j);
else
{
printf(“have not found the num\n“);
exit(-1);//遇到错误推出了
}
printf(“Please input the num you want data= “);
scanf(“%d“&p->num);
ptr=head;
while(p&&i {
ptr=ptr->next;i++;
}
if(p==NULL||i==j)
exit(-1);
p->next=ptr->next;
ptr->next=p;
return head;
}
pnode Delete_list(pnode head)
{
int i=1j=0d=-1;
pnode ptr q;
ptr=head->next;
int num;
printf(“Please input the num you want delete num=“);
scanf(“%d“&num);
while(ptr!=NULL)
{
j++;
if(ptr->num==num)
{
printf(“have found it\n“);
d=1;
break;
}
else
ptr=ptr->next;
}
ptr=head;
while(ptr&&i {
i++;
ptr=ptr->next;
}
if(ptr==NULL||i==j)
{
printf(“errorcannot find the number\n“);
exit(-1);
}
q=ptr->next;
ptr->next=q->next;
free(q);
return head;
}
pnode Sort_list(pnode head)
{
pnode p1p2ptemppfinish=NULL;
p1=head->next;
for(p1;p1->next!=pfinish;)
{
for(p2=p1;p2->next!=pfinish;)
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 208959 2014-11-28 23:51 stu_message\Debug\stu_manage.exe
文件 227152 2014-11-28 23:51 stu_message\Debug\stu_manage.ilk
文件 25306 2014-11-28 23:51 stu_message\Debug\stu_manage.obj
文件 222368 2014-11-28 18:17 stu_message\Debug\stu_manage.pch
文件 541696 2014-11-28 23:51 stu_message\Debug\stu_manage.pdb
文件 184384 2014-11-28 18:02 stu_message\Debug\stu_message.exe
文件 196840 2014-11-28 18:16 stu_message\Debug\stu_message.ilk
文件 222368 2014-11-28 17:28 stu_message\Debug\stu_message.pch
文件 508928 2014-11-28 18:02 stu_message\Debug\stu_message.pdb
文件 41984 2014-11-28 23:51 stu_message\Debug\vc60.idb
文件 53248 2014-11-28 23:51 stu_message\Debug\vc60.pdb
文件 7665 2014-11-28 23:51 stu_message\stu_manage.cpp
文件 3449 2014-11-28 23:40 stu_message\stu_manage.dsp
文件 526 2014-11-28 23:52 stu_message\stu_manage.dsw
文件 41984 2014-11-28 23:52 stu_message\stu_manage.ncb
文件 48640 2014-11-28 23:52 stu_message\stu_manage.opt
文件 772 2014-11-28 23:51 stu_message\stu_manage.plg
文件 4343 2014-11-28 18:16 stu_message\stu_message.dsp
文件 528 2014-11-28 17:27 stu_message\stu_message.dsw
文件 33792 2014-11-28 18:16 stu_message\stu_message.ncb
文件 48640 2014-11-28 18:16 stu_message\stu_message.opt
文件 1014 2014-11-28 18:16 stu_message\stu_message.plg
目录 0 2014-11-28 23:51 stu_message\Debug
目录 0 2014-11-28 23:52 stu_message
----------- --------- ---------- ----- ----
2624586 24
相关资源
- 用c语言编写的一个中国象棋
- 分支定界算法C语言实现源程序
- C语言 聊天室
- STM32 LCD12864并口驱动实验 完整C语言代
- MSP430单片机秒表程序完整 完整C语言代
- 费诺编码的C语言实现
- c语言求硬币找零钱问题
- C语言图书管理课设报告
- Verilog C语言 实现CRC16校验 高低字节分
- c语言学习例题.docx
- openssl加解密C语言代码
- 大一C语言基础学习练习例题大部分考
- 酒店管理系统c语言数组
- 大学C语言考试题库(含答案).docx
- 计算机二级c语言编程题库100题
- 计算机二级C语言视频全国
- 文件加密解密
- 大一C语言考试上机使用的开卷材料
- C语言-银行管理系统.zip
- linux C语言 QQ模拟聊天.zip
- 修正后的C语言实现巴特沃斯程序
- c语言实现 拉格朗日插值方法
- 银行管理系统C语言版
- 交通咨询系统-C语言
- C语言程序设计经典100例
- 不相关随机无标度网络UCM的C语言实现
- ER网络的C语言实现
- C++API中文帮助文档
- c语言题库,里面都是选择题
- 飞机订票系统C语言
评论
共有 条评论