C语言小型物流仓储管理系统课程设计

}

if((fp=fopen(\{

printf(\open file!\\n\exit(0); }

fwrite(stoc,sizeof(struct stock),an,fp); fclose(fp); }

//------------------------------------------------------------------------ void Creatoutstock()//创建出库记录并改变库存记录 {

int i=0,j=0,k=0,n=0; int sum_stock=0; FILE *fp;

sum_stock=read_stock();//读取stock.txt入stoc[] printf(\共有家电物资%d种\\n\for(n=0;n

printf(\电器名称 品牌名称 型号 出库数量 出库时间(年 月 日) \\n\提货人姓名

scanf(\%s %s %d %d %d %d %s\out[n].outstocknum ,&out[n].outtime .year ,&out[n].outtime .month,&out[n].outtime .day,out[n].delivername);

printf(\有物资出库!\\n\

}

if((fp=fopen(\{

printf(\open file!\\n\exit(0); }

for(j=0;j

for(i=0;i<3;i++)

if((strcmp(stoc[i].elename,out[j].elename )==0)&&(strcmp(stoc[i].brand,out[j].brand)==0)&&(strcmp(stoc[i].type,out[j].type)==0))

{ k=1;

if(out[j].outstocknum<=stoc[i].stocknum) {

fwrite(&out[j],sizeof(struct outstock),1,fp);

stoc[i].stocknum=stoc[i].stocknum-out[j].outstocknum; printf(\资源%s出库成功!\\n\} else

if(out[j].outstocknum>stoc[i].stocknum) //else

{ printf(\超出库存量!\\n按任意键继续!\\n\getch(); } } if( k==0 )

{ printf(\库存中不存在该信息!\\n按任意键继续!\\n\getch(); } }

fclose(fp);

if((fp=fopen(\{

printf(\open file :stock.txt !\\n\exit(0); }

fwrite(stoc,sizeof(struct stock),sum_stock,fp); fclose(fp); }

//----------------------;voidSearchElename();;voidSearchBrand();;voidSearchDate();;voidSearchElenameAndBran;voidPrintStock(structsto;voidPrintInstock(structi;voidPrintOutstock(stru

//-------------------------------------------- void SearchElename(); void SearchBrand(); void SearchDate();

void SearchElenameAndBrand(); void PrintStock(struct stock *p); void PrintInstock(struct instock *p); void PrintOutstock(struct outstock *p);

//-------------------------------------------------------------------- void SearchMenu()//查询菜单 { int select;

while(1) {

printf(\欢迎使用查询功能!\\n\

printf(\printf(\输入 1 按电器名称查询 \\n\

printf(\输入 2 按品牌名称查询 \\n\printf(\输入 3 按日期查询 \\n\

printf(\输入 4 按电器名称和型号查询\\n\printf(\输入 0 退出查询功能\\n\printf(\请选择查询方式 :\scanf(\getchar(); switch(select) {

case 1:SearchElename();break; case 2:SearchBrand();break; case 3:SearchDate();break;

case 4:SearchElenameAndBrand();break; case 0:return;

default:printf(\错误!请重新选择!\\n\} } }

//----------------------------------------------------- void SearchElename()//按照电器名称查询

{ int i;

int sum_stock=0; int boolean=0; char celename[20],c='y';

sum_stock=read_stock();//库存中家电的种类 while(c=='y'||c=='Y') {

boolean=0;

printf(\请输入电器名称:\scanf(\getchar();

for(i=0;i

if( strcmp(stoc[i].elename,celename)==0 ) {

printf(\库存电器%d的信息\\n\PrintStock(&stoc[i]); boolean=1;

printf(\按任意键继续!\\n\getch(); }

if( boolean==0 )

printf(\没有电器: %s\\n\

printf(\继续查询其他库存信息吗?)(y/n):\c=getchar(); getchar();

联系客服:779662525#qq.com(#替换为@) 苏ICP备20003344号-4