C语言程序仓库管理系统Word文档格式.docx

上传人:b****5 文档编号:19813550 上传时间:2023-01-10 格式:DOCX 页数:13 大小:16.24KB
下载 相关 举报
C语言程序仓库管理系统Word文档格式.docx_第1页
第1页 / 共13页
C语言程序仓库管理系统Word文档格式.docx_第2页
第2页 / 共13页
C语言程序仓库管理系统Word文档格式.docx_第3页
第3页 / 共13页
C语言程序仓库管理系统Word文档格式.docx_第4页
第4页 / 共13页
C语言程序仓库管理系统Word文档格式.docx_第5页
第5页 / 共13页
点击查看更多>>
下载资源
资源描述

C语言程序仓库管理系统Word文档格式.docx

《C语言程序仓库管理系统Word文档格式.docx》由会员分享,可在线阅读,更多相关《C语言程序仓库管理系统Word文档格式.docx(13页珍藏版)》请在冰豆网上搜索。

C语言程序仓库管理系统Word文档格式.docx

\t\t*2.显示货物信息*\n"

\t\t*3.查找货物信息*\n"

\t\t*4.修改货物信息*\n"

\t\t*5.删除货物信息*\n"

\t\t*6.退出系统*\n"

\t\t**************************************************\n"

*********************************"

printf("

*请选择你要输入数(1-6):

*\n"

while

(1)

{

n=getchar();

getchar();

if(n<

'

1'

||n>

6'

**********************************"

*出错了!

请再次输入(1-6):

}

else

break;

returnn;

}

voidappend()/*货物信息输入函数*/

structInfoinfo;

FILE*fp;

charch;

if((fp=fopen("

F:

\\test\\filemolde\\123.txt"

"

wb"

))==NULL)

******************\n"

*不能打开文件!

getch();

exit

(1);

do

\tnum:

"

gets(info.num);

\tname:

gets(info.name);

\tprice:

scanf("

%d"

&

info.price);

\tamount:

info.amount);

fwrite(&

info,sizeof(info),1,fp);

***************************\n"

*还需要输入吗?

(Y/N):

ch=getchar();

}while(ch=='

Y'

||ch=='

y'

fclose(fp);

voidprintf1()

*************************************************************************\n"

\t\t%-10s\t%-10s\t%-10s\t%-10s\n"

num"

name"

price"

amount\n"

voidprintf2(structInfoinfo)

-------------------------------------------------------------------------\n"

\t\t%-10s\t%-10s\t%-10d\t%-10d\n"

info.num,info.name,info.price,info.amount);

voiddisplay()/*货物信息显示函数*/

intm=0;

if((fp=fopen("

rb"

))==NULL)

******************"

*"

while(fread(&

info,sizeof(info),1,fp)==1)

m++;

if(m==1)

printf1();

printf2(info);

if((m!

=0)&

&

(m%10==0))

*****************************\n"

*输入任何键继续*"

\n\n"

printf1();

************************************\n"

*总共有%d条记录在其中!

m);

voidsearch()/*货物信息查询函数*/

intflag;

/*flag为1按编号查询,flag为2按姓名查询*/

inttotal=0;

/*记录符合条件的记录的个数*/

charch[10];

charf;

*\t不能打开文件!

rewind(fp);

*查询通过(1:

编号2:

姓名):

flag);

if(flag<

1||flag>

2)

*****************************************\n"

printf("

请再次输入[1:

编号][2:

姓名]*\n"

break;

if(flag==1)/*按编号进行查询*/

*请输入你要查询的编号:

gets(ch);

total=0;

/*符合条件的记录数*/

if(strcmp(ch,info.num)==0)

{

total++;

if(total==1)

}

else/*按姓名进行查询*/

*请输入你要查询的姓名:

if(strcmp(ch,info.name)==0)

*总共有%d记录在其中!

total);

*还需要查询吗?

f=getchar();

}while(f=='

||f=='

voidmodify()/*货物信息修改函数*/

FILE*fp1,*fp2;

if((fp1=fopen("

{

*不能打开文件!

printf("

}

if((fp2=fopen("

\\test\\filemolde\\456.txt"

*请输入你要修改的货物编号:

flag=0;

info,sizeof(info),1,fp1)==1)

printf2(info);

*请输入新的信息:

flag=1;

info,sizeof(info),1,fp2);

fclose(fp1);

fclose(fp2);

if(flag==1)

*修改成功!

remove("

rename("

else

*不能找到这个记录!

*还修改其他吗?

f=getchar();

getchar();

voidDelete()/*货物信息删除函数*/

*请输入你需要删除货物的编号:

flag=1;

break;

else

fclose(fp1);

*删除成功!

*还删除其他吗?

}

voidmain()/*主函数*/

inta;

charnum[20]={"

12345"

pleaseinputthesecret:

\n"

%s"

ch);

if(strcmp(num,ch)==0)

a=1;

if(a==1)

\npleaseenterinthetelproject!

else

\nthesecretiserror"

pleaseinputtherightsecret"

switch(menu())

case'

:

append();

break;

2'

display();

3'

search();

4'

modify();

5'

Delete();

exit(0);

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

当前位置:首页 > 人文社科 > 法律资料

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

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