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

加入VIP,免费下载
 

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

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

下载须知

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

版权提示 | 免责声明

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

C语言程序仓库管理系统.docx

1、C语言程序仓库管理系统#include #include #include #include struct Info char num20; char name20; int price; int amount;char menu() /*菜单选择函数*/ char n; /*n记录选择的菜单*/ system(cls); puts(tt 欢迎来到仓库货物管理系统 ); puts(tt*MENU*n); puts(tt* 1.录入货物信息 *n); puts(tt* 2.显示货物信息 *n); puts(tt* 3.查找货物信息 *n); puts(tt* 4.修改货物信息 *n); puts

2、(tt* 5.删除货物信息 *n); puts(tt* 6.退出系统 *n); puts(tt*n); puts(*); printf(* 请选择你要输入数(1-6): *n); puts(*); while(1) n=getchar(); getchar(); if(n6) puts(*); printf(* 出错了!请再次输入(1-6): *n); puts(*); else break; return n; void append() /*货物信息输入函数*/ struct Info info; FILE * fp; char ch;if(fp=fopen(F:testfilemolde

3、123.txt,wb) = NULL) printf(*n); printf(* 不能打开文件! *n); printf(*n); getch(); exit(1); do printf(tnum:); gets(info.num); printf(tname:); gets(info.name); printf(tprice:); scanf(%d,&info.price); printf(tamount:); scanf(%d,&info.amount); getchar(); fwrite(&info,sizeof(info),1,fp); printf(*n); printf(* 还需

4、要输入吗?(Y/N): *n); printf(*n); ch=getchar(); getchar(); while(ch=Y|ch=y); fclose(fp); void printf1() printf(*n); printf(tt%-10st%-10st%-10st%-10sn,num,name,price,amountn); printf(*n); void printf2(struct Info info) printf(-n); printf(tt%-10st%-10st%-10dt%-10dn,info.num,info.name,info.price,info.amount

5、 ); printf(-n); void display() /*货物信息显示函数*/ struct Info info; FILE * fp; int m=0; if(fp=fopen(F:testfilemolde123.txt,rb)=NULL) printf(*); printf(* 不能打开文件! *); printf(*); getch(); exit(1); while(fread(&info,sizeof(info),1,fp)=1) m+; if(m=1) printf1(); printf2(info); if(m!=0)&(m%10=0) printf(*n); prin

6、tf(* 输入任何键继续 *); printf(*n); getch(); puts(nn); printf1(); fclose(fp); printf(*n); printf(* 总共有%d条记录在其中! *n,m); printf(*n); getch(); void search() /*货物信息查询函数*/ struct Info info; FILE * fp; int flag; /* flag为 1 按编号查询 ,flag为 2 按姓名查询*/ int total=0; /*记录符合条件的记录的个数*/ char ch10; char f; if(fp=fopen(F:test

7、filemolde123.txt,rb) = NULL) printf(*n); printf(* t 不能打开文件! *n); printf(*n); getch(); exit(1); do rewind(fp); printf(*n); printf(* 查询通过(1:编号 2:姓名): *n); printf(*n); while(1) scanf(%d,&flag); getchar(); if(flag2) printf(*n); printf(* 出错了!请再次输入1:编号2:姓名 *n); printf(*n); else break; if(flag=1) /*按编号进行查询

8、*/ printf(*n); printf(* 请输入你要查询的编号: *n); printf(*n); gets(ch); total=0; /*符合条件的记录数*/ while(fread(&info,sizeof(info),1,fp)=1) if(strcmp(ch,info.num)=0) total+; if(total=1) printf1(); printf2(info); else /*按姓名进行查询*/ printf(*n); printf(* 请输入你要查询的姓名: *n); printf(*n); gets(ch); total=0; while(fread(&info

9、,sizeof(info),1,fp)=1) if(strcmp(ch,info.name)=0) total+; if(total=1) printf1(); printf2(info); printf(*n); printf(* 总共有%d记录在其中! *n,total); printf(*n); printf(*n); printf(* 还需要查询吗?(Y/N): *n); printf(*n); f=getchar(); getchar(); while(f=Y|f=y); fclose(fp); void modify() /*货物信息修改函数*/ struct Info info;

10、 FILE * fp1,* fp2; int flag; char ch10; char f; do if(fp1=fopen(F:testfilemolde123.txt,rb) = NULL) printf(*n); printf( * 不能打开文件! *n); printf(*n); getch(); exit(1); if(fp2=fopen(F:testfilemolde456.txt,wb) = NULL) printf(*n); printf( * 不能打开文件! *n); printf(*n); getch(); exit(1); printf(*n); printf(* 请输

11、入你要修改的货物编号: *n); printf(*n); gets(ch); flag=0; while(fread(&info,sizeof(info),1,fp1)=1) if(strcmp(ch,info.num)=0) printf1(); printf2(info); printf(*n); printf(* 请输入新的信息: *n); printf(*n); printf(tnum:); gets(info.num); printf(tname:); gets(info.name); printf(tprice:); scanf(%d,&info.price); printf(ta

12、mount:); scanf(%d,&info.amount); getchar(); flag=1; fwrite(&info,sizeof(info),1,fp2); fclose(fp1); fclose(fp2); if(flag=1) printf(*n); printf(* 修改成功! *n); printf(*n); remove(F:testfilemolde123.txt); rename(F:testfilemolde456.txt,F:testfilemolde123.txt); else printf(*n); printf(* 不能找到这个记录! *n); print

13、f(*n); printf(*n); printf(* 还修改其他吗?(Y/N): *n); printf(*n); f=getchar(); getchar(); while(f=y|f=Y); void Delete() /*货物信息删除函数*/ struct Info info; FILE * fp1,* fp2; int flag; char ch10; char f; do if(fp1=fopen(F:testfilemolde123.txt,rb) = NULL) printf(*n); printf(* t 不能打开文件! *n); printf(*n); getch(); e

14、xit(1); if(fp2=fopen(F:testfilemolde456.txt,wb) = NULL) printf(*n); printf(* t 不能打开文件! *n); printf(*n); getch(); exit(1); printf(*n); printf(* 请输入你需要删除货物的编号: *n); printf(*n); gets(ch); flag=0; while(fread(&info,sizeof(info),1,fp1)=1) if(strcmp(ch,info.num)=0) printf1(); printf2(info); flag=1; break;

15、 else fwrite(&info,sizeof(info),1,fp2); fclose(fp1); fclose(fp2); if(flag=1) printf(*n); printf(* 删除成功! *n); printf(*n); remove(F:testfilemolde123.txt); rename(F:testfilemolde456.txt,F:testfilemolde123.txt); else printf(*n); printf(* 不能找到这个记录! *n); printf(*n); printf(*n); printf(* 还删除其他吗?(Y/N): *n);

16、 printf(*n); f=getchar(); getchar(); while(f=y|f=Y); void main() /*主函数*/ while(1) int a; char f; char ch10; char num20=12345; printf(please input the secret :n); scanf(%s,ch); if(strcmp(num,ch)=0) a=1; if(a=1) printf(nplease enter in the telproject !n); f=getchar(); getchar(); break; else printf(n the secret is error); printf(please input the right secret); while(1) switch(menu() case1:append();break; case2:display();break; case3:search();break; case4:modify();break; case5:Delete();break; case6:exit(0);break;

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

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