




已阅读5页,还剩7页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
实验设备管理系统-课程设计实验设备管理系统|c语言程序代码编程小程序设计|c语言课程设计报告课程案例 #include #include struct instrumentchar p_num12;char name12;char spec12;int amount;int price;int s_price;struct instrument *next;struct instrument *head;struct in_instrumentchar num12;char p_num12;char name12;int amount;int price;int t_price;struct in_instrument *next;struct in_instrument *ihead;struct out_instrumentchar num12;char p_num12;char name12;int amount;int price;int t_price;struct out_instrument *next;struct out_instrument *ohead;struct quit_instrumentchar num12;char p_num12;char name12;int amount;int price;int t_price;struct quit_instrument *next;struct quit_instrument *qhead;int init()head=ihead=ohead=qhead=NULL;printf(0: Quitn);printf(1: Enter the information of in instrumentn);printf(2: Enter the information of out instrumentn);printf(3: Enter the information of quit instrumentn);printf(4: Total the information of instrumentn);int menu()printf(1:insert datan);printf(2:delete datan);printf(3:modify datan);printf(4:select datan);printf(Other to quitn);int menu2()printf(0: Quitn);printf(1: Enter the information of in instrumentn);printf(2: Enter the information of out instrumentn);printf(3: Enter the information of quit instrumentn);printf(4: Total the information of instrumentn);int insert_instrument()struct instrument * p1,* p;p1=(struct instrument *)malloc(sizeof(struct instrument);p=head;if (p=NULL)/*开始没有数据*/printf(Enter the data of instrumentn);printf(Include the spbh,name,style,num,price,sale_price of instrumentn);scanf(%s%s%s%d%d%d,&p1-p_num,&p1-name,&p1-spec,&p1-amount,&p1-price,&p1-s_price);head=p1;head-next=NULL;return 0;while(p-next!=NULL)/*把指针移到链表末端,在链表末端插入数据*/p=p-next;p-next=p1;printf(Enter the datan);scanf(%s%s%s%d%d%d,&p1-num,&p1-p_num,&p1-name,&p1-amount,&p1-price,&p1-t_price);p1-next=NULL;int in_insert()struct in_instrument * p1,* p;p1=(struct in_instrument *)malloc(sizeof(struct in_instrument);p=ihead;if (p=NULL)/*开始没有数据*/printf(Enter the data of in instrumentn);printf(Include the rkbh,spbh,name,number,price,total_pricen);scanf(%s%s%s%d%d%d,&p1-num,&p1-p_num,&p1-name,&p1-amount,&p1-price,&p1-t_price);ihead=p1;ihead-next=NULL;return 0;while(p-next!=NULL)/*把指针移到链表末端,在链表末端插入数据*/p=p-next;p-next=p1;printf(Enter the datan);scanf(%s%s%s%d%d%d,&p1-num,&p1-p_num,&p1-name,&p1-amount,&p1-price,&p1-t_price);p1-next=NULL;int in_modify()char m_num12;struct in_instrument * p;p=ihead;printf(Enter the modify numn);scanf(%s,&m_num);if (p=NULL)/*开始没有数据*/printf(Sorry! No data can be foundn);return 0;while(p!=NULL)if (strcmp(p-num,m_num)=0)printf(Enter the new data without numn);scanf(%s%s%d%d%d,&p-p_num,&p-name,&p-amount,&p-price,&p-t_price);printf(One data had modifiedn);return 0;p=p-next;printf(Sorry! No num has foundn);int in_select()char s_num12;struct in_instrument * p;p=ihead;printf(Enter the select numn);scanf(%s,&s_num);while(p!=NULL)if (strcmp(p-num,s_num)=0)printf(The data you want is:n);printf( %s %s %s %d %d %dn,p-num,p-p_num,p-name,p-amount,p-price,p-t_price);return 0;p=p-next;printf(Sorry! No num has foundn);int in_delete()char d_num12;struct in_instrument * p1,* p;p=ihead;printf(Enter the delete numn);scanf(%s,&d_num);if (p=NULL)/*开始没有数据*/printf(No data can be foundn);return 0;if (strcmp(p-num,d_num)=0 & p-next=NULL)/*链表只有一个数据,且是要删除的*/ihead=NULL;printf(One data has been deletedn);return 0;if (strcmp(p-num,d_num)=0 & p-next!=NULL)/*要删除的数据在链表的头上*/ihead=ihead-next;printf(One data has been deletedn);return 0;while(p-next!=NULL)p1=p-next;if (strcmp(p1-num,d_num)=0)p-next=p1-next;printf(One data has been deletedn);return 0;p=p-next;printf(Sorry! No num has foundn);int out_insert()struct out_instrument * p1,* p;p1=(struct out_instrument *)malloc(sizeof(struct out_instrument);p=ohead;if (p=NULL)/*开始没有数据*/printf(Enter the data of out instrumentn);printf(Include the ckbh,spbh,name,number,price,total_pricen);scanf(%s%s%s%d%d%d,&p1-num,&p1-p_num,&p1-name,&p1-amount,&p1-price,&p1-t_price);ohead=p1;ohead-next=NULL;return 0;while(p-next!=NULL)/*把指针移到链表末端,在链表末端插入数据*/p=p-next;p-next=p1;printf(Enter the datan);scanf(%s%s%s%d%d%d,&p1-num,&p1-p_num,&p1-name,&p1-amount,&p1-price,&p1-t_price);p1-next=NULL;int out_modify()char m_num12;struct out_instrument * p;p=ohead;printf(Enter the modify numn);scanf(%s,&m_num);if (p=NULL)/*开始没有数据*/printf(Sorry! No data can be foundn);return 0;while(p!=NULL)if (strcmp(p-num,m_num)=0)printf(Enter the new data without numn);scanf(%s%s%d%d%d,&p-p_num,&p-name,&p-amount,&p-price,&p-t_price);printf(One data had modifiedn);return 0;p=p-next;printf(Sorry! No num has foundn);int out_select()char s_num12;struct out_instrument * p;p=ohead;printf(Enter the select numn);scanf(%s,&s_num);while(p!=NULL)if (strcmp(s_num,p-num)=0)printf(The data you want is:n);printf( %s %s %s %d %d %dn,p-num,p-p_num,p-name,p-amount,p-price,p-t_price);return 0;p=p-next;printf(Sorry! No num has foundn);int out_delete()char d_num12;struct out_instrument * p1,* p;p=ohead;printf(Enter the delete numn);scanf(%s,&d_num);if (p=NULL)/*开始没有数据*/printf(No data can be foundn);return 0;if (strcmp(p-num,d_num)=0 & p-next=NULL)/*链表只有一个数据,且是要删除的*/ohead=NULL;printf(One data has been deletedn);return 0;if (strcmp(p-num,d_num)=0 & p-next!=NULL)/*要删除的数据在链表的头上*/ohead=ohead-next;printf(One data has been deletedn);return 0;while(p-next!=NULL)p1=p-next;if (strcmp(p1-num,d_num)=0)p-next=p1-next;printf(One data has been deletedn);return 0;p=p-next;printf(Sorry! No num has foundn);int quit_insert()struct quit_instrument * p1,* p;p1=(struct quit_instrument *)malloc(sizeof(struct quit_instrument);p=qhead;if (p=NULL)/*开始没有数据*/printf(Enter the data of quit instrumentn);printf(Include the thbh,spbh,name,number,price,total_pricen);scanf(%s%s%s%d%d%d,&p1-num,&p1-p_num,&p1-name,&p1-amount,&p1-price,&p1-t_price);qhead=p1;qhead-next=NULL;return 0;while(p-next!=NULL)/*把指针移到链表末端,在链表末端插入数据*/p=p-next;p-next=p1;printf(Enter the datan);scanf(%s%s%s%d%d%d,&p1-num,&p1-p_num,&p1-name,&p1-amount,&p1-price,&p1-t_price);p1-next=NULL;int quit_modify()char m_num12;struct quit_instrument * p;p=qhead;printf(Enter the modify numn);scanf(%s,&m_num);if (p=NULL)/*开始没有数据*/printf(Sorry! No data can be foundn);return 0;while(p!=NULL)if (strcmp(p-num,m_num)=0)printf(Enter the new data without numn);scanf(%s%s%d%d%d,&p-p_num,&p-name,&p-amount,&p-price,&p-t_price);printf(One data had modifiedn);return 0;p=p-next;printf(Sorry! No num has foundn);int quit_select()char s_num12;struct quit_instrument * p;p=qhead;printf(Enter the select numn);scanf(%s,&s_num);while(p!=NULL)if (strcmp(s_num,p-num)=0)printf(The data you want is:n);printf( %s %s %s %d %d %dn,p-num,p-p_num,p-name,p-amount,p-price,p-t_price);return 0;p=p-next;printf(Sorry! No num has foundn);int quit_delete()char d_num12;struct quit_instrument * p1,* p;p=qhead;printf(Enter the delete numn);scanf(%s,&d_num);if (p=NULL)/*开始没有数据*/printf(No data can be foundn);return 0;if (strcmp(p-num,d_num)=0 & p-next=NULL)/*链表只有一个数据,且是要删除的*/qhead=NULL;printf(One data has been deletedn);return 0;if (strcmp(p-num,d_num)=0 & p-next!=NULL)/*要删除的数据在链表的头上*/qhead=qhead-next;printf(One data has been deletedn);return 0;while(p-next!=NULL)p1=p-next;if (strcmp(p1-num,d_num)=0)p-next=p1-next;printf(One data has been deletedn);return 0;p=p-next;printf(Sorry! No num has foundn);int total()int in_num=0,in_price=0;int out_num=0,out_price=0;int num=0,price=0;struct in_instrument *ip;struct out_instrument *op;struct instrument *p;ip=ihead;while(ip!=NULL)in_num+=ip-amount;in_price+=ip-t_price;ip=ip-next;op=ohead;while(op!=NULL)out_num+=op-amount;out_price+=op-t_price;op=op-next;p=head;while(p!=NULL)num+=p-amount;price+=p-s_price;p=p-next;printf(The in instruments total number and total price is:n);printf(%d %dn,in_num,in_price);printf(The out instruments total number and total price is:n);printf(%d %dn,out_num,out_price);printf(The instruments total number and total price is:n);printf(%d %dn,num,price);int in_case()int choice;printf(The information of in instrument:n);while(1)printf(Enter the choicen);scanf(%d,&choice);switch(choice)case 1: in_i
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年宠物智能用品行业研发创新与市场适应性研究
- 健康减脂干货知识培训课件
- 伤情鉴定讲解课件
- 2026届江苏省宿迁市宿迁中学高三物理第一学期期末教学质量检测模拟试题
- 2026届山东省东营市利津县一中高三物理第一学期期末质量跟踪监视试题
- 《为中华之崛起而读书》课件 部编语文四年级上册
- 企业消防安全培训演练课件
- 中职护理考试题库及答案
- 纪检专项资金管理办法
- 窗口临时用工管理办法
- 2025年部编版新教材语文小学一年级上册教学计划(含进度表)
- T/CECS 10214-2022钢面镁质复合风管
- 学校“1530”安全教育记录表(2024年秋季全学期)
- DL∕T 5776-2018 水平定向钻敷设电力管线技术规定
- (正式版)SH∕T 3548-2024 石油化工涂料防腐蚀工程施工及验收规范
- 粤教版小学科学五年级上册同步教学课件(全册)
- 《导游业务》教案资料.docx
- 河南省科技版三年级劳动与技术上册教案
- 施工现场安全标志和安全防护设施设置方案
- 范里安中级微观经济学第六版中文课件(中)
- 普罗名特VAMd计量泵操作手册
评论
0/150
提交评论