ImageVerifierCode 换一换
格式:DOCX , 页数:17 ,大小:63.75KB ,
资源ID:5092994      下载积分:12 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/5092994.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(源程序医院药房药品管理系统C++.docx)为本站会员(b****4)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

源程序医院药房药品管理系统C++.docx

1、源程序医院药房药品管理系统C+源程序(医院药房药品管理系统C+)源程序:# include /包含文件读写# include # include /包含strcmp()字符是否相等#include /包含system(cls)清屏#define MAX 60 /下列字符数组的大小struct Date/日期 char yearMAX;/年 char monthMAX;/月 char dayMAX;/日;struct Goods/药品信息 char nameMAX;/药品名称 char priceMAX;/药品价格 char numberMAX;/药品数量 char costMAX;/药品总价

2、char kindMAX;/药品的种类 Date indate;/入库日期 Date xiaoqi;/到期时间 Goods * next;/下一个结点 cintemp-xiaoqi.yeartemp-xiaoqi.monthtemp-xiaoqi.day; couttemp-kind; if(head=NULL)head=temp;current=temp; /head头指针,current尾指针 else current-next=temp,current=temp; do coutg; if(g!=Y&g!=N) coutn error !n ; while(g!=Y&g!=N); whi

3、le(g=Y);/判断是否继续插入新结点 void Open ()/打开一个数据文件,并建立链表关联 和文件中的记录对应 char fname20;/文件名称 coutfname; /输入要打开的文件名 ifstream infile (fname);/创建输入文件流 infilelength; coutn length is: lengthendl; /if(length=0)cout 数据为空n; for(int i=0;inext=NULL; infilet-namet-pricet-numbert-costt-kind t-indate.yeart-indate.montht-inda

4、te.day; if(head=NULL)head=t;current=t;/跟上面的链表创建相似 else current-next=t,current=t; infile.close();/关闭文件流 /open void Save ()/保存链表信息到文件 if(length=0) cout 列表为空 不需存盘 n; return ; char fname20;/文件名称 coutfname; ofstream outfile(fname);/创建输出文件流 Goods * temp=head-next; outfilelengthendl;/先写入文件的长度 while (temp!=

5、NULL)/把所有结点写入到文件fname outfilename price number cost kind indate.year indate.month indate.day xiaoqi.year xiaoqi.month xiaoqi.daynext; outfile.close();/关闭文件流 void printinfor( Goods * current)/输出一个结点的信息到字符界面 if(current=NULL) coutn元素为空! n ; return; cout.fill( ); coutname; cout.width(8); cout.width(8);

6、coutprice; cout.width(8); coutnumber; cout.width(8); coutcost; /就是给current-cost10个字符输出,不够往前面加 空格 cout.width(10); coutkind; cout.width(10); coutindate.year.indate.month.indate.day; cout.width(10); coutxiaoqi.year.xiaoqi.month.xiaoqi.day; coutnext;if(current=NULL)cout列表为空 n;return ;cout.fill( );cout.w

7、idth(2);cout名称; cout.width(8);cout价格;cout.width(8);cout数量;cout.width(8);cout总费用;cout.width(10);cout药品的种类;cout.width(15);cout购进时间;cout.width(15);cout有效期;coutnext; /showGoods *Searchindate(Date t) /按购入日期搜索 返回结点指针temp /结构体t含有t.year t.month t.day三个信息块Date d;bool f=false;Goods * temp;current=head-next; w

8、hile(current!=NULL) d=current-indate; if(!strcmp(d.year,t.year)&!strcmp(d.month,t.month)&!strcmp(d.day,t.day) temp=current; f=true; break; current=current-next; if(f=false) coutn 没有满足要求的信息 n; return NULL; return temp;void Queryindate()/按入库日期查询Date t;coutt.yeart.montht.day; printinfor(Searchindate (t

9、);/Queryindate()Goods * Searchname (char r)/搜索药品名 返回结点指针temp Goods * temp; current=head-next; bool f=false; while(current!=NULL) if(strcmp(current-name,r)=0) temp=current; f=true; break; current=current-next; if(f=false) coutn 商品名为 : r 的商品不存在 n ; return NULL; return temp;void Queryname() /按药品名查询char

10、 rMAX;coutr;printinfor(Searchname (r);void Query ()/查询函数 一个次级菜单char m; do cout * endl; cout* 按入库的时间查询 *endl; cout* 按药品的名称查询 *endl; cout* 退出 *endl; cout * m; switch (m) /分别调用按不同查询方式下的函数 case a: Queryindate();break; case b: Queryname();break; case c: return ; default: couterror! ; while(m!=h);/Query v

11、oid Removebynumber () /按总量删除某个结点 char tMAX; /需要删除的总量值 bool f=false; /表示是否找到满足要求的结点 Goods * temp; /指向找到的结点,并删除 coutt; current=head; while(current-next!=NULL) if(strcmp(current-next-number,t)=0) /判断是否满足条件 temp=current-next; current-next=temp-next; length-; /没删除一个结点,链表长度减1 f=true; delete temp;/释放结点cout

12、next; if(f=false)/false没有改动,表示没有满足条件的结点 cout此药品不存在 ,无须删除 n; /Removebynumbervoid Removebyname () /按名称删除某个结点 char t20; bool f=false; Goods * temp; coutt; current=head; while(current-next!=NULL) if(strcmp(current-next-name,t)=0) temp=current-next; current-next=temp-next; length-; f=true; delete temp;co

13、utnext; if(f=false) cout此药品不存在 ,无须删除 n; /Removebynamevoid Removebyindate () /按购进时间删除某个结点 Date t,d; bool f=false; Goods * temp; coutt.yeart.montht.day; current=head; while(current-next!=NULL) d=current-next-indate; if(d.year=t.year&d.month=t.month&d.day=t.day) temp=current-next; current-next=temp-nex

14、t; length-; f=true; delete temp;coutnext; if(f=false) cout此元素不存在 ,无须删除 n; /Removebyindatevoid Remove ()/删除函数 char g=Y; do cout * endl; cout* 按药品总数量删除 *endl; cout* 按药品名称删除 *endl; cout* 按入库时间删除 *endl; cout* 退出 *endl; cout * g; switch (g) case a: Removebynumber ();break; case b: Removebyname();break; c

15、ase c: Removebyindate();break; case d: return ; default: coutnext!=NULL)/找到尾指针 current=current-next; temp=new Goods; temp-next=NULL;length+;/链表长加1 couttemp-name; couttemp-price; couttemp-number; couttemp-cost; couttemp-indate.yeartemp-indate.monthtemp-indate.day; couttemp-xiaoqi.yeartemp-xiaoqi.mont

16、htemp-xiaoqi.day; cout 请输入药品的种类:temp-kind; current-next=temp;/这时current指向尾指针,将要插入的结点接到current后面 current=temp;/addvoid Modify ()/通过药品名找到要修改的数据项 char nMAX; cout请输入您要修改的药品名:n; Goods * temp=Searchname (n);/按商品名查找 couttemp-price; couttemp-cost; couttemp-indate.yeartemp-indate.monthtemp-indate.day; coutte

17、mp-number; couttemp-kind;void operation ()char g=Y;docoutt;cout.fill(*);cout.width(21);cout*;cout医院药房管理系统;cout.fill(*);cout.width(19);cout*; coutn; coutt*n; coutt MWDICINE STORE MANAGEMENT SYSTERMn; coutt*n; coutt & & 药品入库 & n; coutt & & 药品出库 & n; coutt & & 药品调价 & n; coutt & & 新药品入库 & n; coutt & & 打

18、开文件 & n; coutt & & 保存文件 & n; coutt & 显示库存 & n; coutt & 药品查询 & n; coutt & 上下限制 & n; coutt & 退出 & n; coutt*n; coutt*n;coutt;cout.fill(*);cout.width(18);cout*;cout医院药房管理系统;cout.fill(*);cout.width(22);cout*;coutg;switch (g)case C: Creatlist();break;case A: Add();break;case M: Modify ();break;case D: Show ();break;case Q: Query ();break;case R: Remove();break;case O: Open ();break;case S: Save();break;case N: system (cls);break;case E: return ;default: cout error! input the right character ! n;/switchwhile(g!=E);/operation;/Cangkuguanliint main ()Cangkuguanli A; A.operation(); return 0;

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

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