C语言课程设计报告学生宿舍管理系统.docx

上传人:b****2 文档编号:2904810 上传时间:2023-05-05 格式:DOCX 页数:15 大小:65.85KB
下载 相关 举报
C语言课程设计报告学生宿舍管理系统.docx_第1页
第1页 / 共15页
C语言课程设计报告学生宿舍管理系统.docx_第2页
第2页 / 共15页
C语言课程设计报告学生宿舍管理系统.docx_第3页
第3页 / 共15页
C语言课程设计报告学生宿舍管理系统.docx_第4页
第4页 / 共15页
C语言课程设计报告学生宿舍管理系统.docx_第5页
第5页 / 共15页
C语言课程设计报告学生宿舍管理系统.docx_第6页
第6页 / 共15页
C语言课程设计报告学生宿舍管理系统.docx_第7页
第7页 / 共15页
C语言课程设计报告学生宿舍管理系统.docx_第8页
第8页 / 共15页
C语言课程设计报告学生宿舍管理系统.docx_第9页
第9页 / 共15页
C语言课程设计报告学生宿舍管理系统.docx_第10页
第10页 / 共15页
C语言课程设计报告学生宿舍管理系统.docx_第11页
第11页 / 共15页
C语言课程设计报告学生宿舍管理系统.docx_第12页
第12页 / 共15页
C语言课程设计报告学生宿舍管理系统.docx_第13页
第13页 / 共15页
C语言课程设计报告学生宿舍管理系统.docx_第14页
第14页 / 共15页
C语言课程设计报告学生宿舍管理系统.docx_第15页
第15页 / 共15页
亲,该文档总共15页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

C语言课程设计报告学生宿舍管理系统.docx

《C语言课程设计报告学生宿舍管理系统.docx》由会员分享,可在线阅读,更多相关《C语言课程设计报告学生宿舍管理系统.docx(15页珍藏版)》请在冰点文库上搜索。

C语言课程设计报告学生宿舍管理系统.docx

C语言课程设计报告学生宿舍管理系统

 

《高级语言程序设计》课程设计

说明书

 

设计题目:

学生宿舍管理系统

 

 

一、总体设计……………………………………………………………………3

1.程序的总体设计…………………………………………………………3

2.函数原型声明……………………………………………………………3

二、用户说明……………………………………………………………………4

1、菜单界面………………………………………………………………5

2、入住登记界面……………………………………………………………5

3、删除界面…………………………………………………………………5

4、浏览界面…………………………………………………………………6

5、查询修改…………………………………………………………………6

6、排序界面…………………………………………………………………6

7、退出………………………………………………………………………6

三、小结…………………………………………………………………………7

四、参考文献……………………………………………………………………7

五、源程序代码…………………………………………………………………7

 

一、总体设计

1.程序的总体设计

◎确定界面,使用户可选择操作项目(录入,删除,浏览,修改,查询,排序)。

◎录入:

使用结构体,要求用户输入楼栋、房号、面积、可住人数、已住人数

◎删除:

按房号删除以上信息

◎查询:

按房号查询以上信息

◎修改:

按房号修改以上信息

◎排序:

按已住人数排序信息

 

2.函数原型声明

structroom*add(structroom*head);

程序设计(第二版).北京:

清华大学出版社,1999

[2]邓文新.张宏烈.哈尔滨工业大学出版社

[3]XX.

 

五、附件源程序代码

#include<>

#include<>

#include<>

#include<>

structroom

{

intLnum;

intFnum;

intsqua;

intmaxnum;

intinnum;

structroom*next;

};

structroom*add(structroom*head);住登记||\n");

printf("||2.删除信息||\n");

printf("||3.信息浏览||\n");

printf("||4.查询修改||\n");

printf("||5.按入住人数排序||\n");

printf("||6.退出系统||\n");

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

printf("[]--------------------------------------------[]\n");

printf("请选择服务项目!

\n");

flushall();

scanf("%d",&x);//菜单选择

if(head->next==NULL&&x!

=1&&x!

=6)

{

printf("系统中无入住信息,请先进行入房登记!

\n");

gotoA;

}

switch(x)

{

case1:

head=add(head);

system("cls");

printf("登记完毕!

\n");

continue;

case2:

head=del(head);

T:

scanf("%d",&y);

while(y!

=1&&y!

=0)

{

printf("输入错误!

请重新输入!

\n");

gotoT;

}

if(y==1)

{system("cls");

continue;}

else

can();

gotoN;

case3:

show(head);

printf("是否返回菜单界面进行其他操作(1/0)\n");

J:

scanf("%d",&y);

while(y!

=1&&y!

=0)

{

printf("输入错误!

请重新输入!

\n");

gotoJ;

}

if(y==1)

{system("cls");

continue;}

else

{

can();

gotoN;

}

case4:

serh(head);

system("cls");

continue;

case5:

head=sort(head);//修改点

printf("是否返回菜单界面进行其他操作(1/0)\n");

scanf("%d",&y);

while(y!

=1&&y!

=0)

{

printf("输入错误!

请重新输入!

\n");

gotoJ;

}

if(y==1)

{system("cls");

continue;}

else

{

can();

gotoN;

}

continue;

case6:

can();

gotoQ;

default:

printf("输入错误!

请重新输入!

\n");

}

N:

if(y==0)

break;

Q:

if(x==6)

break;

}

}

 

structroom*add(structroom*head)//入住登记

{

structroom*h,*p;

inti=0,n;

h=head;

printf("请输入要登记的入房数:

\n");

scanf("%d",&n);

printf("请输入入住信息:

\n楼号房号面积最大入住人数已入住人数\n");

printf("数据须按规定顺序输入,不同数据用空格分开。

\n");

for(i=0;i

{

p=(structroom*)malloc(sizeof(structroom));

flushall();

scanf("%d%d%d%d%d",&p->Lnum,&p->Fnum,&p->squa,&p->maxnum,&p->innum);

p->next=h->next;

h->next=p;

}

returnh;

}

 

structroom*del(structroom*h)//退房登记

{

intx;

structroom*p,*q;

p=h->next;

q=h;

printf("请输入退房房号:

\n");

scanf("%d",&x);

if(p==NULL)

{

printf("不存在此入房登记!

\n是否返回菜单界面进行其他操作(1/0)");

}

else

{

while(p)

{

if(p->Fnum==x)

{

q->next=p->next;

free(p);

printf("删除成功!

是否返回菜单界面进行其他操作(1/0)\n");

gotoK;

}

else

{

q=p;

p=p->next;

}

}

if(p==NULL)

{

printf("不存在此入房登记!

\n是否返回菜单界面进行其他操作(1/0)\n");

}

K:

returnh;

}

returnh;

}

voidshow(structroom*h)

{

structroom*p;

p=h->next;

if(p==NULL)

{

printf("无信息可显示!

\n");

}

else

{

printf("\n楼号房号面积所容纳人数已入住人数\n\n");

while(p)

{

printf("%-7d%-7d%-8d%-13d%-8d\n",p->Lnum,p->Fnum,p->squa,p->maxnum,p->innum);

p=p->next;

}

}

}

 

voidserh(structroom*h)//入住信息查询与修改

{

structroom*p;

intx,y,z;

p=h->next;

H:

printf("请输入要查找的房号:

\n");

scanf("%d",&z);

while(p->Fnum!

=z)

{

p=p->next;

if(p==NULL)

break;

}

if(p==NULL)

{

printf("您所查询的房间号无人入住!

是否继续查找(1/0)\n");

Z:

scanf("%d",&x);

while(x!

=1&&x!

=0)

{

printf("输入错误!

请重新输入!

\n");

gotoZ;

}

if(x==1)

gotoH;

}

else

{

printf("查询结果如下:

\n");

printf("\n楼号房号面积所容纳人数已入住人数\n\n");

printf("%-7d%-7d%-8d%-13d%-8d\n",p->Lnum,p->Fnum,p->squa,p->maxnum,p->innum);

printf("如需修改请选择1,按其他任意键返回菜单界面\n");

scanf("%d",&y);

if(y==1)

{

printf("请对入住信息进行修改(按顺序输入)\n");

scanf("%d%d%d%d%d",&p->Lnum,&p->Fnum,&p->squa,&p->maxnum,&p->innum);

printf("修改成功!

修改结果如下:

\n");

printf("\n楼号房号面积所容纳人数已入住人数\n\n");

printf("%-7d%-7d%-8d%-13d%-8d\n",p->Lnum,p->Fnum,p->squa,p->maxnum,p->innum);

}

}

}

 

structroom*sort(structroom*h)//修改点

{

structroom*p1,*p2,*t,*temp,*q;/*定义临时指针*/

temp=h->next;/*将原表的头指针所指的下一个结点作头指针*/

h->next=NULL;/*第一个结点为新表的头结点*/

while(temp!

=NULL)/*当原表不为空时,进行排序*/

{

t=temp;/*取原表的头结点*/

temp=temp->next;/*原表头结点指针后移*/

p1=h;/*设定移动指针p1,从头指针开始*/

p2=h;/*设定移动指针p2做为p1的前驱,初值为头指针*/

while(t->innuminnum&&p1!

=NULL)/*作成绩平均分比较*/

{

p2=p1;/*待排序点值小,则新表指针后移*/

p1=p1->next;

}

if(p1==p2)/*p1==p2,说明待排序点值大,应排在首位*/

{

t->next=p1;/*待排序点的后继为p*/

h=t;/*新头结点为待排序点*/

}

else/*待排序点应插入在中间某个位置p2和p1之间,如p为空则是尾部*/

{

t->next=p1;/*t的后继是p1*/

p2->next=t;/*p2的后继是t*/

}

}

q=(structroom*)malloc(sizeof(structroom));//修改点

q->next=h;//修改点

while(h->next!

=NULL)

{

printf("%-7d%-7d%-8d%-13d%-8d\n",h->Lnum,h->Fnum,h->squa,h->maxnum,h->innum);

h=h->next;

}

h=q;

returnh;//修改点

}

 

voidcan()

{

printf("欢迎再次使用学生宿舍管理系统!

再见~\n");

}

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 初中教育 > 语文

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2