c语言课程管理系统 c语言课程设计教学设备管理系统文档格式.docx

上传人:b****7 文档编号:22565445 上传时间:2023-02-04 格式:DOCX 页数:6 大小:16.91KB
下载 相关 举报
c语言课程管理系统 c语言课程设计教学设备管理系统文档格式.docx_第1页
第1页 / 共6页
c语言课程管理系统 c语言课程设计教学设备管理系统文档格式.docx_第2页
第2页 / 共6页
c语言课程管理系统 c语言课程设计教学设备管理系统文档格式.docx_第3页
第3页 / 共6页
c语言课程管理系统 c语言课程设计教学设备管理系统文档格式.docx_第4页
第4页 / 共6页
c语言课程管理系统 c语言课程设计教学设备管理系统文档格式.docx_第5页
第5页 / 共6页
点击查看更多>>
下载资源
资源描述

c语言课程管理系统 c语言课程设计教学设备管理系统文档格式.docx

《c语言课程管理系统 c语言课程设计教学设备管理系统文档格式.docx》由会员分享,可在线阅读,更多相关《c语言课程管理系统 c语言课程设计教学设备管理系统文档格式.docx(6页珍藏版)》请在冰豆网上搜索。

c语言课程管理系统 c语言课程设计教学设备管理系统文档格式.docx

&

scanf(&

%ld&

&

amp;

p1-&

number);

\n输入设备名称:

%s&

p1-&

name);

\n输入生产厂家:

adr);

\n输入购置日期:

date);

\n输入台数:

taishu);

\n输入单价:

price);

money=(p1-&

taishu)*(p1-&

\n输入备注:

other);

head=NULL;

while(p1-&

number!

=0){n=n+1;

if(n==1)head=p1;

elsep2-&

next=p1;

p2=p1;

p1=(structequipment*)malloc(LEN);

\n输入教学设备编号:

if(p1-&

number==0)break;

else{printf(&

&

}}p2-&

next=NULL;

return(head);

}voidprint(){clrscr();

gotoxy(33,0);

\16[{-80|10@30,30=4

(2)5****中南工业大学教学设备明细账****}]&

gotoxy(3,5);

设备编号设备名称生产厂家购置日期台数单价金额备注\n&

}voidprint1(){inti,j;

for(i=0;

i&

=8;

i++)line(70*i+16,60,70*i+16,60+36*(n+1));

for(j=0;

j&

=n+1;

j++)line(16,60+36*j,70*8+16,60+36*j);

}/*显示函数*/voidoutput(structequipment*head){structequipment*p;

p=head;

print();

if(head!

=NULL)do{printf(&

\n%-9ld%-9s%-9s%-9ld%-9ld%-9ld%-9ld%-9s\n&

p-&

number,p-&

name,p-&

adr,p-&

date,p-&

taishu,p-&

price,p-&

money,p-&

p=p-&

next;

}while(p!

=NULL);

print1();

getch();

}/*修改函数*/voidchange(structequipment*head){structequipment*p;

longnum;

cleardevice();

for(;

;

){printf(&

\n请输入要修改的设备编号:

num);

while(num!

=p-&

number&

p-&

next!

=NULL){p=p-&

}if(num!

number){printf(&

\n对不起,无此记录!

按任意键返回!

break;

}else{printf(&

\n请输入新的设备记录:

\n输入教学设备名称:

printf(&

money=(p-&

taishu)*(p-&

\n是否继续退出,Y/N?

if(getch()!

=&

#39;

y&

)break;

}}}/*查找函数*/voidsearch(structequipment*head){structequipment*p;

charchoice;

longkey;

do{clrscr();

if(head==NULL)printf(&

\n无此记录!

\n请输入要查找的设备编号:

key);

while(key!

}if(key==p-&

number){print();

\n%-9ld%-9s%-9s%-9ld%-9ld%-9ld%-9ld%-9s&

\n无此编号,请按任意键返回!

}printf(&

\n您是否需要继续查找?

(y/n)\n&

choice=getch();

}while(choice==&

}/*删除函数*/structequipment*del(structequipment*head){structequipment*p1,*p2;

longnumber;

intb=0;

if(head==NULL){printf(&

\n无此记录!

}else{b=0;

if(del1==NULL)b=b+1;

if(del2==NULL)b=b+1;

if(del3==NULL)b=b+1;

if(b!

=0)printf(&

\n回收站还有%d的空间!

b);

elseprintf(&

\n回收站已满,无法再删除!

\n请输入要删除的教学设备编号:

p1=head;

while(number!

=p1-&

=NULL){p2=p1;

p1=p1-&

}if(number==p1-&

\n进行逻辑删除还是物理删除,Y/N?

if(getch()==&

){if(del1==NULL)del1=p1;

elseif(del2==NULL)del2=p1;

elsedel3=p1;

}if(p1==head)head=p1-&

next=p1-&

\n已删除设备编号%ld记录!

number);

b=b-1;

\n无此设备记录!

\n是否继续删除/Y/N?

}}while(getch()==&

}/*恢复函数*/structequipment*recover(structequipment*head){structequipment*p0,*p1,*p2;

longrec_num,a=0;

gotoxy(1,3);

do{printf(&

\n可恢复的设备编号:

if(del1!

=NULL){a=a+1;

\n%ld&

del1-&

}if(del2!

del2-&

}if(del3!

del3-&

}if(a==0){printf(&

\n没有可恢复的数据,请按任意键退出!

}printf(&

\n请输入要恢复的教学设备编号:

rec_num);

if(rec_num==del1-&

number){p0=del1;

del1=NULL;

}elseif(rec_num==del2-&

number){p0=del2;

del2=NULL;

}elseif(rec_num==del3-&

number){p0=del3;

del3=NULL;

}else{printf(&

\n输入错误,按任意键返回!

}p1=head;

if(head==NULL){head=p0;

p0-&

}else{while((p0-&

number)&

(p1-&

=NULL)){p2=p1;

}if(p0-&

number){if(head==p1){head=p0;

}elsep2-&

next=p0;

}else{p1-&

}}n=n+1;

output(head);

\n恢复成功,请按任意键返回!

\n是否继续进行恢复Y/N?

}while(getch()==&

}/*添加函数*/structequipment*insert(structequipment*head,structequipment*p){charchoice;

p=(structequipment*)malloc(LEN);

\n请输入新的教学设备资料:

\n输入编号:

\n输入名称:

\n输入单价:

if(n==0){n=n+1;

head=p;

}else{p-&

next=head;

n++;

\n您是否要继续添加?

}/*统计函数*/voidcount(structequipment*head){intsum1=0,sum2=0,sum3=0,sum4=0,sum5=0,sum6=0,sum7=0,sum8=0;

structequipment*p;

while(p){for(p=head;

p!

=NULL;

next){sum1+=p-&

taishu;

sum2+=p-&

money;

if(p-&

money&

200){sum3+=p-&

sum4+=p-&

}elseif(p-&

price&

800){sum5+=p-&

sum6+=p-&

}else{sum7+=p-&

sum8+=p-&

}}}output(head);

\n合计%d%d\n&

sum1,sum2);

n=n+1;

n=n-1;

\n200元以下的设备总台数及总金额:

%d%d&

sum3,sum4);

\n200--800元之间的设备总台数及总金额:

sum5,sum6);

\n800元以上的设备总台数及总金额:

sum7,sum8);

}/*保存函数*/voidsave(structequipment*head){FILE*fp;

structequipment*p;

\n请输入要保存的文件名:

name);

if((fp=fopen(name,&

wb&

))==NULL){printf(&

\n对不起!

不能

建立新文件!

return;

}while(p-&

=NULL){fwrite(p,LEN,1,fp);

\n保存结束,请按任意键返回!

fclose(fp);

}/*打开函数*/structequipment*dakai(void){structequipment*head,*p1,*p2;

FILE*fp=NULL;

p1=p2=(structequipment*)malloc(LEN);

\n请输入要打开的文件名:

head=p1;

rb&

\n对不起,没有该文件!

请按任意键返回!

}fread(p1,LEN,1,fp);

while(!

feof(fp)){p2-&

fread(p1,LEN,1,fp);

p2-&

\n文件已输出,请按任意键返回!

}main(){chari;

longkey,a;

intdrive=DETECT,mode;

initgraph(&

drive,&

mode,&

setbkcolor(9);

\16[co4st8e320,130,0,360,300,70,2,4]&

\16[{-3|3@48,24=2(14)9**大学}]&

\16[{-90|100@60,60=11(13)9教学设备管理系统}]&

\16[{-400|400@17,17=8(12)9设计者:

自动化0411xxx}]&

\16[{-250|250@20,20=8(4)9请按Enter键进入}]&

){cleardevice();

\16[{-80|1@45,36=4

(2)6******菜单******}]&

\16[{-100|50@48,48=3(7)6a输入}]&

\16[{-400|50@48,48=3(7)6b显示}]&

\16[{-100|110@48,48=3(7)6c修改}]&

\16[{-400|110@48,48=3(7)6d查找}]&

\16[{-100|170@48,48=3(7)6e删除}]&

\16[{-400|170@48,48=3(7)6f恢复}]&

\16[{-100|230@48,48=3(7)6g添加}]&

\16[{-400|230@48,48=3(7)6h统计}]&

\16[{-100|290@48,48=3(7)6i保存}]&

\16[{-400|290@48,48=3(7)6j打开}]&

\16[{-100|350@48,48=3(7)6k退出}]&

\16[{-350|400@24,24=3(7)4请选择a至j}]&

i=getch();

if(i==&

k&

)break;

elseswitch(i){case&

a&

:

creat();

case&

b&

output(head);

c&

change(head);

d&

search(head);

e&

head=del(head);

#

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

当前位置:首页 > 高等教育 > 文学

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1