谁能帮忙写一个学生公寓管理系统的C语言程序啊??谢谢啦 !!!

2:项目背景学生公寓管理软件(1)需要处理的基础数据该校区拥有学生公寓不超过1500套,每套房可住2人,3人或4人,公寓信息包括:房间号,面积,层次,朝向,基本设施,定价... 2:项目背景
学生公寓管理软件
(1) 需要处理的基础数据
该校区拥有学生公寓不超过1500套,每套房可住2人,3人或4人,公寓信息包括:房间号,面积,层次,朝向,基本设施,定价,现状(应住人数,实住人数)。学生信息包括:姓名,学号,所在学院,年级,入住日期,打算离开日期,所住房间号,预订房间号。
(2) 用菜单选择并完成下述功能
1) 入住,即将学生信息添加到公寓信息库中
2) 预定,根据公寓信息,学生可预订某套房间
3) 换房,修改公寓信息库
4) 统计,公寓入住情况统计,月,年公寓出租情况
5) 查询,查询房源和学生信息
展开
 我来答
1044972638
2010-07-04 · TA获得超过305个赞
知道答主
回答量:196
采纳率:0%
帮助的人:110万
展开全部
你看一下这个有没有错,有些地方你可以改一下,好比不超过1500套,看看其他地方有没有需要改的,或者有什么错误,有什么不符合的,你可以稍微修改一下,我觉得这个应该 差不多符合你的要求了,大体上差不多,有必要自己修改吧
# include <stdio.h>
# include <string.h>
# include <ctype.h>
# include <stdlib.h>
# define largestnum 50
struct dormitory
{
int HouseNo;
int HouseArea;
int TotalNo;
int MovedInNo;
};
typedef struct dormitory RM;

void AppendRecord(RM *head,int m)
{
RM *p;
for(p=head;p<head+m;p++)
{
printf("\nInput HouseNo:");
scanf("%d",&p->HouseNo);
printf("Input HouseArea:");
scanf("%d",&p->HouseArea);
printf("Input TotalNo:");
scanf("%d",&p->TotalNo);
printf("Input MovedInNo:");
scanf("%d",&p->MovedInNo);
}
}

void PrintRecord(RM *head,int m)
{
RM *p;
char str[100]={'\0'};
strcat (str,"HouseNo HouseArea TotalNo MovedInNo");
printf("%s",str);
for(p=head;p<head+m;p++)
{
printf("\n%5d%5d%5d%5d",p->HouseNo,p->HouseArea,p->TotalNo,p->MovedInNo);

}
}

int SearchNum(RM *head,int num,int N)
{
int i;
for(i=0;i<N;i++)
{
if((head+i)->HouseNo==num) return i;
}
return -1;
}

void SearchRecord(RM *head,int N)
{
int number,findNo;
printf("please input the nunber you want search:");
scanf("%d",&number);
findNo=SearchNum(head,number,N);
if(findNo==-1)
{
printf("\nNot found!\n");
}
else
{
PrintRecord(head+findNo,1);
}
}

void SortRecord(RM *head,int N)
{
int i,j,k;
RM temp;
for(i=0;i<N-1;i++)
{
k=i;
for(j=i;j<N;j++)
{if((head+j)->MovedInNo>(head+k)->MovedInNo)
{
k=j;}
}
if(k!=i)
{
temp=*(head+k);
*(head+k)=*(head+i);
*(head+i)=temp;
}
}
}

void DeleteRecord(RM *head, int N)
{
int Dnumber ,FoundNu;char x;int y,i;
printf("please Input the number you want delete:");
scanf("%d",&Dnumber);
FoundNu=SearchNum(head,Dnumber,N);
if(FoundNu==-1)
{
printf("the number you want delete is not found");
}
else
{
y=FoundNu;
PrintRecord(head+FoundNu,1);
printf("please make sure your decision Y/N");
scanf( " %c",&x);
switch(x)
{
case'y':for(i=y;i<N;i++)
*(head+i)=*(head+i+1);
break;
case'Y':for(i=y;i<N;i++)
*(head+i)=*(head+i+1);
break;

case'n':break;
case'N':break;
}
}

}

void AddRecord (RM *head, int N)
{
int Addnumber,findNO;int i;

printf("please input the number you want to add:");
scanf("%d",&Addnumber);
findNO=SearchNum(head,Addnumber,N);
if(findNO==-1)
{
AppendRecord(head+N,1);
}

}

void AmendRecord(RM *head,int N)
{
int x,findNo;
printf("please input the number your want amend:");
scanf("%d",&x);
findNo=SearchNum(head,x,N);
if(findNo==-1)
{
printf("the number you want to amend is not found!");
}
else
{
AppendRecord(head+findNo,1);
PrintRecord(head,N);
}
}
char Menu(void)
{
char ch;
printf("\nManagement for dormitory\n");
printf(" 1.Append record\n");
printf(" 2.List record\n");
printf(" 3.Search record\n");
printf(" 4.sort record\n");
printf(" 5.delete record\n");
printf(" 0.Exit\n");
printf("please input your choice:");
scanf(" %c",&ch);
return ch;
}

main()
{

char ch;
int m;
RM room[largestnum];static i=0;int N;
clrscr();
printf("please input the total number of the house(m<50) :");
scanf("%d",&m);
while(1)
{

ch=Menu();
N=m+i;
switch(ch)
{
case'1':AppendRecord(room,N);
break;
case'2':PrintRecord(room,N);
break;
case'3':SearchRecord(room,N);
break;
case'4':SortRecord(room,N);
printf("\nSorted result\n");
PrintRecord(room,N);
break;
case'5':DeleteRecord(room,N);
i--;
break;
case'6':AddRecord(room,N);
i++;
break;
case'7':AmendRecord(room,N);
break;
case'0':exit(0);
printf("End of program!");
break;
default:printf("Input error!");
break;
}
}
}
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式