C語言宿舍管理系統課設
專案說明
本系統基於C語言開發,適用於剛入門的C語言新手專案課設,開發軟體採用VC++6.0開發,VS,DEV C++等均可執行。
專案執行截圖
程式碼介面截圖
部分關鍵程式碼:
int find_check(stu *head,stu *p) //檢查宿舍是否滿員,符合返回1,不符合返回0
{
//print(head); //測試
//printf("進入\n");
stu *i;
for(i=head->next;i!=NULL;i=i->next)
{
if(!strcmp(p->dorm,i->dorm)&&(p->dorm_num_id==i->dorm_num_id)&&(p->dorm_num==i->dorm_num))
{
printf("\t宿舍資訊重複\n");
return 0;
}
}
return 1;
}
stu *creat()//建立連結串列
{
stu *head,*end,*p;
char id[10];
head=NULL;
head=(stu*)malloc(sizeof(stu));
head->next=NULL;
end=head;
printf("\t輸入學號:");
fflush(stdin);
gets(id);
while(strlen(id)>0)
{
if(find_id(id,head))//學號查重,重複返回0,否則1
{
p=(stu*)malloc(sizeof(stu));
strcpy(p->id,id);
printf("\t輸入姓名:");
gets(p->name);
printf("\t輸入公寓名稱:");
scanf("%s",p->dorm);
printf("\t輸入宿舍名稱:");
scanf("%d",&p->dorm_num);
printf("\t輸入床位號:");
scanf("%d",&p->dorm_num_id);
if(find_check(head,p)) //檢查宿舍是否滿員,符合返回1,不符合返回0
{
printf("\t手機號:");
fflush(stdin);
gets(p->number);
printf("\t年齡:");
scanf("%d",&p->age);
printf("\t性別:");
scanf("%s",p->sex);
printf("\t專業班級:");
scanf("%s %d",p->major,&p->banji);
printf("\t輸入入學年份:");
scanf("%d",&p->enUniversity);
end->next=p;
end=p;
p->next=NULL;
}
}
printf("\t輸入學號:");
fflush(stdin);
gets(id);
}
return head;
}
獲取完整程式碼:
https://max.book118.com/html/2020/1010/5123032014003010.shtm
https://wenku.baidu.com/view/63801a2067ce0508763231126edb6f1afe0071c1