宿舍管理系统c语言源代码 你有学生宿舍管理系统的软件和源代码吗你需要多少分了

沈乐雪
导读 今天来聊聊关于宿舍管理系统c语言源代码,你有学生宿舍管理系统的软件和源代码吗你需要多少分了的文章,现在就为大家来简单介绍下宿舍管理...

今天来聊聊关于宿舍管理系统c语言源代码,你有学生宿舍管理系统的软件和源代码吗你需要多少分了的文章,现在就为大家来简单介绍下宿舍管理系统c语言源代码,你有学生宿舍管理系统的软件和源代码吗你需要多少分了,希望对各位小伙伴们有所帮助。

1、/* Note:Your choice is C IDE */#include#include#define LEN sizeof(struct student)int m;struct student { long num; char name[20]; char addr[30]; char xueli[20]; struct student *next; };void main() { int n,w; struct student *head=0; void print(struct student *head); struct student *creat(); struct student *add(struct student *head); struct student *del(struct student *head); struct student *search(struct student *head); system("cls"); do { printf("*******************************************"); printf("*** Student Information Management System***"); printf("********************************************"); printf("**** choose ********************"); printf("**** 1 Enter new data *************"); printf("**** 2 Modify data **************"); printf("**** 3 Search by people .xueli and num ****"); printf("**** 4 Browse data *****************"); printf("**** 5 add data ************"); printf("**** 6 Exit *************"); printf("******************************************"); printf("*******************************************"); printf("choose your number(1-6):[ ]"); do { scanf("%d",&n); if(n>6||nnum); printf("Please input name:"); scanf("%s",p1->name); printf("address:"); scanf("%s",p1->addr); printf("xueli:"); scanf("%s",p1->xueli); while(p1->num!=0) { m=m+1; if(m==1)head=p1; else p2->next=p1; p2=p1; p1=(struct student *)malloc(LEN); printf("number:"); scanf("%ld",&p1->num); printf("name:"); scanf("%s",p1->name); printf("address:"); scanf("%s",p1->addr); printf("xueli:"); scanf("%s",p1->xueli); } p2->next=0; print(head); return(head); }struct student *del(struct student *head) { long num; struct student *p1,*p2; if(head==0) { printf("list null"); exit(0); } p1=head; printf("Which number do you want del:"); scanf("%ld",&num); while(num!=p1->num&&p1->next!=0) { p2=p1; p1=p1->next; } if(num==p1->num) { if(p1==head)head=p1->next; else p2->next=p1->next; printf("delete:%ld",num); m=m-1; } else printf("%ld not been found!",num); print(head); return(head); }struct student * add(struct student * head) { struct student *p0,*p1,*p2; p0=(struct student *)malloc(LEN); printf("number:"); scanf("%ld",&p0->num); printf("name:"); scanf("%s",p0->name); printf("address:"); scanf("%s",p0->addr); printf("xueli:"); scanf("%s",p0->xueli); p1=head; if(head==0) { head=p0; p0->next=0; } else { while((p0->num>p1->num)&&(p1->next!=0)) { p2=p1; p1=p1->next; } if(p0->numnum) { if(head==p1)head=p0; else p2->next=p0; p0->next=p1; } else { p1->next=p0; p0->next=0; } } m=m+1; print(head); }void print(struct student *head) { struct student *p; printf("Now,There %d records are:",m); p=head; if(head!=0) do { printf("%ld",p->num); printf("%s",p->name); printf("%s",p->addr); printf("%s",p->xueli); p=p->next; }while(p!=0); }struct student *search(struct student *head) { int n,w; struct student *name(struct student *head); struct student *number(struct student *head); struct student *xueli(struct student *head); printf("***** 7 use name to search****"); printf("***** 8 use number to search****"); printf("***** 9 use xueli to search****"); printf("choose your number[ ]"); do { scanf("%d",&n); if(n>9||nname)!=0&&p1->next!=0) { p1=p1->next; w=0; } if(strcmp(nam,p1->name)==0) { printf("%ld%s%s%s",p1->num,p1->name,p1->addr,p1->xueli); w=1; } if(w==0)printf("%s not been found!",nam); }struct student *number(struct student *head) { long num; int w=0; struct student *p1; printf("please input the number:"); scanf("%ld",&num); if(head==0) { printf("list null!"); exit(0); } p1=head; while(p1->next!=0) { if(num==p1->num) { w=1; printf("%ld%s%s%s",p1->num,p1->name,p1->addr,p1->xueli); } p1=p1->next; } if(w==0)printf("%ld not been found!",num); }struct student *xueli(struct student *head) { struct student *p1; char xue[20]; int w=0; if(head==0) { printf("list null"); exit(0); } printf("please input xueli:"); scanf("%s",xue); p1=head; while(p1->next!=0) { if(strcmp(xue,p1->xueli)==0) { printf("%ld%s%s%s",p1->num,p1->name,p1->addr,p1->xueli); w=1; } p1=p1->next; } if(w==0)printf("%s not been found",xue); }。

相信通过你有学生宿舍管理系统的软件和源代码吗你需要多少分了这篇文章能帮到你,在和好朋友分享的时候,也欢迎感兴趣小伙伴们一起来探讨。

标签:

免责声明:本文由用户上传,如有侵权请联系删除!