C C++课程设计 物品库存管理系统.docx

上传人:b****2 文档编号:3119968 上传时间:2023-05-05 格式:DOCX 页数:28 大小:19.72KB
下载 相关 举报
C C++课程设计 物品库存管理系统.docx_第1页
第1页 / 共28页
C C++课程设计 物品库存管理系统.docx_第2页
第2页 / 共28页
C C++课程设计 物品库存管理系统.docx_第3页
第3页 / 共28页
C C++课程设计 物品库存管理系统.docx_第4页
第4页 / 共28页
C C++课程设计 物品库存管理系统.docx_第5页
第5页 / 共28页
C C++课程设计 物品库存管理系统.docx_第6页
第6页 / 共28页
C C++课程设计 物品库存管理系统.docx_第7页
第7页 / 共28页
C C++课程设计 物品库存管理系统.docx_第8页
第8页 / 共28页
C C++课程设计 物品库存管理系统.docx_第9页
第9页 / 共28页
C C++课程设计 物品库存管理系统.docx_第10页
第10页 / 共28页
C C++课程设计 物品库存管理系统.docx_第11页
第11页 / 共28页
C C++课程设计 物品库存管理系统.docx_第12页
第12页 / 共28页
C C++课程设计 物品库存管理系统.docx_第13页
第13页 / 共28页
C C++课程设计 物品库存管理系统.docx_第14页
第14页 / 共28页
C C++课程设计 物品库存管理系统.docx_第15页
第15页 / 共28页
C C++课程设计 物品库存管理系统.docx_第16页
第16页 / 共28页
C C++课程设计 物品库存管理系统.docx_第17页
第17页 / 共28页
C C++课程设计 物品库存管理系统.docx_第18页
第18页 / 共28页
C C++课程设计 物品库存管理系统.docx_第19页
第19页 / 共28页
C C++课程设计 物品库存管理系统.docx_第20页
第20页 / 共28页
亲,该文档总共28页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

C C++课程设计 物品库存管理系统.docx

《C C++课程设计 物品库存管理系统.docx》由会员分享,可在线阅读,更多相关《C C++课程设计 物品库存管理系统.docx(28页珍藏版)》请在冰点文库上搜索。

C C++课程设计 物品库存管理系统.docx

CC++课程设计物品库存管理系统

物品库存管理系统作者:

admin日期:

2008-05-24

字体大小:

小中大

#include

#include

#include

#include

#include

usingnamespacestd;

#include

#include

#include

#include

#include

#include

voidmain();

voidsbnam();

voidsbpri();

voidss();

voidsmallss();

voidsmsmss();

voidnam();

longmath();

intma();

voidship();

voidsell1();

voidsell2();

voidmanaC();

voidshowmenue();

charxjh,xyj='0',ln='0',zzz,cll;

charbuffer[16],buff3[16];

longI,J;

intnn=0,ent=0,itt=0;

stringcnam;

classItem;

//******************************************************************

classclient//客户类,Item类是它的友元类

{stringnam;//客户名字

public:

client(){}

~client(){}

friendclassItem;

};

//**************************************************************************

classItem

{stringname;//物品名

floatprice;//价格

longnumber;//商品编号

clientcli;//定义客户类对象

public:

Item(){}

~Item(){}

voidstock1();

voidsnum();

};

voidItem:

:

stock1()//两个类的成员函数,有赋值、存入功能

{stringa,c;

charit;

SYSTEMTIMEt;

GetLocalTime(&t);

ofstreamoutfile;//定义输出文件类

if(xyj=='5')

{cout<:

";

client3:

cin>>cli.nam;

cnam=cli.nam;

gotostock15;}

stock12:

itt++;

cout<:

";

cin>>name;

if(itt==2)

{itt=0;

gotostock14;}

stock13:

cout<:

";

cin>>price;

stock14:

cout<<"\n\n确定

(1),重新输入货物名

(2),重新输入价格(3),退出(0)>:

";

gotostock16;//

stock15:

cout<<"\n\n确定

(1),重新输入客户名

(2),退出(0)>:

";

stock16:

cin>>it;

if(it=='0')

main();

elseif(it=='1')

{if(xyj=='5')

{ifstreamff1;

ofstreamff2;

ff1.open("n.txt",ios:

:

in);

ff1>>nn;

ff1.close();

ifstreamff3;

ff3.open("ent.txt",ios:

:

in);

ff3>>ent;

ff3.close();

cout<<"\n\n请输入预订商品编号";

ss();

ifstreamff4;

ff4.open("ent.txt",ios:

:

in);

ff4>>ent;

ff4.close();

ent++;

ff2.open("ent.txt",ios:

:

trunc);

ff2<

ff2.close();

cout<<"继续

(1),返回主菜单

(2),退出(0)>:

";

stock17:

charp17;

cin>>p17;

if(p17=='0')

exit(0);

elseif(p17=='1')

stock1();

elseif(p17=='2')

main();

else

gotostock17;

}

gotostock11;}

elseif(it=='2')

{if(xyj=='5')

gotoclient3;

elseif(xyj=='1')

{gotostock12;

}}

elseif((it=='3')&&(xyj!

='5'))

{gotostock13;}

else

{if(xyj=='5')

gotostock15;

gotostock14;}

stock11:

ifstreamf1;

ofstreamf2;

f1.open("n.txt");

f1>>nn;

f1.close();

nn++;

f2.open("n.txt",ios:

:

trunc);

f2<

f2.close();

snum();

outfile.open("stock.txt",ios:

:

app);//打开一个输出文件“file2.out”

if(!

outfile)

cout<<"不能打开文件!

"<

outfile<

:

left)<

<

:

left)<

<

:

left)<

<

:

left)<

(2)<

<

:

left)<

<

:

left)<

outfile.close();

outfile.open("storageC.txt",ios:

:

app);//打开一个输出文件“file2.out”

if(!

outfile)

cout<<"不能打开文件!

"<

outfile<

:

left)<

<

:

left)<

<

:

left)<

<

:

left)<

(2)<

<

:

left)<

<

:

left)<

outfile.close();

}

voidItem:

:

snum()//stock1函数的辅助函数

{ifstreamifile;

ifile.open("n.txt",ios:

:

in);

ifile>>nn;

ifile.close();

number=2108000+nn;

}

//**************************************************************************

 

voidshow()//浏览函数

{system("cls");

system("colorf1");

charc2;

charbuf[1000];

if((cll=='2')&&(xyj=='3'))

{stringstr1="商品名",str2="商品价格",str3="进货日期",str4="商品编号",str5="出货日期";

cout<

:

left)<

<

:

left)<

<

:

left)<

<

:

left)<

<

:

left)<

cout<<"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<

elseif(((cll=='3')||(cll=='1'))&&(xyj=='3'))

{stringstr1="商品名",str2="商品价格",str3="进货日期",str4="商品编号";

cout<

:

left)<

<

:

left)<

<

:

left)<

<

:

left)<

cout<<"--------------------------------------------------------------"<

elseif(xyj=='5')

{stringstr5="客户名",str1="商品名",str2="商品价格",str3="进货日期",str4="商品编号";

cout<

:

left)<

<

:

left)<

<

:

left)<

<

:

left)<

<

:

left)<

cout<<"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<

ifstreaminfile;

if((cll=='1')&&(xyj=='3'))

{infile.open("stock.txt",ios:

:

in);}

elseif((cll=='2')&&(xyj=='3'))

{infile.open("shipment.txt",ios:

:

in);}

elseif((cll=='3')&&(xyj=='3'))

{infile.open("storageC.txt",ios:

:

in);}

elseif(xyj=='5')

{infile.open("client.txt",ios:

:

in);}

while(infile.getline(buf,1000))

cout<

infile.close();

if(((cll=='2')&&(xyj=='3'))||(xyj=='5'))

cout<<"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<

else

cout<<"--------------------------------------------------------------"<

cout<<"\n返回主菜单(0)返回上一级

(1)>:

";

loop4:

cin>>c2;

if(c2=='1')

{if(xyj=='3')

showmenue();

elseif(xyj=='5')

manaC();}

elseif(c2=='0')

main();

else

{cout<<"请重新选择:

";

gotoloop4;}

}

voidlog()//进货记录函数—往文件种写入数据

{charc1;

loop2:

ItemA;

A.stock1();

cout<<"\n\n继续

(1)返回主菜单

(2)退出系统(0)>:

";

loop3:

cin>>c1;

if(c1=='1')

gotoloop2;

elseif(c1=='2')

main();

elseif(c1=='0')

exit(0);

else

{cout<<"请重新选择:

";

gotoloop3;}

}

voidSearch()//搜索菜单函数

{

system("cls");

system("colorf2");

cout<<"\n\n\n\n";

cout<<"ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ\n";

cout<<"⊙⊙\n";

cout<<"Ⅱ商品搜索菜单Ⅱ\n";

cout<<"⊙⊙\n";

cout<<"Ⅱ按价格

(1)Ⅱ\n";

cout<<"⊙⊙\n";

cout<<"Ⅱ按名字

(2)Ⅱ\n";

cout<<"⊙⊙\n";

cout<<"Ⅱ返回主菜单(3)Ⅱ\n";

cout<<"⊙⊙\n";

cout<<"ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ\n";

cout<<"\n请输入你要的操作编号:

";

loop4:

cin>>xjh;

if(xjh<'1'||xjh>'3')

{cout<<"请重新选择:

";

gotoloop4;}

switch(xjh)

{case'1':

sbpri();break;

case'2':

sbnam();break;

case'3':

main();break;}

}

voidsbnam()//按商品名搜索函数

{system("cls");

system("colorf0");

ifstreamifile;

cout<<"您要搜索的货物是"<

ifile.open("n.txt",ios:

:

in);

ifile>>nn;

ifile.close();

ss();}

voidss()//搜索辅助函数

{longm;

ints=0;

charca;

charbuff[16],buff1[16],buff2[16],mes[100];

loop10:

nam();

strcpy(buff1,buffer);

strcpy(buff3,buffer);

if(xjh=='1')

gotoxjh6;

elseif((xyj=='2')||(xjh=='2')||(xyj=='5'))

gotoxjh7;

else

exit(0);

xjh6:

nam();

strcpy(buff2,buffer);

xjh7:

stringstr5="商品名",str6="商品价格",str7="进货日期",str8="商品编号";

cout<

:

left)<

<

:

left)<

<

:

left)<

<

:

left)<

cout<<"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<

ifstreamifile;

ifile.open("storageC.txt",ios:

:

in);

for(I=0;I<=nn;I++)

{if((xyj=='2')||(xyj=='5'))

gotoxyj1;

elseif((xjh=='1')&&(xyj!

='2')&&(xyj!

='5'))

gotoxjh1;

elseif((xjh=='2')&&(xyj!

='2')&&(xyj!

='5'))

gotoxjh2;

else

exit(0);

xyj1:

ifile.seekg(m=I*72+54,ios:

:

beg);

gotoxjh3;

xjh1:

ifile.seekg(m=I*72+18,ios:

:

beg);

gotoxjh3;

xjh2:

ifile.seekg(m=I*72,ios:

:

beg);

xjh3:

ifile>>buff;

if(strlen(buff1)==strlen(buff))

gotoloop7;

else

gotoloop8;

loop7:

if(xjh=='1')

gotoxjh4;

elseif((xjh=='2')||(xyj=='2')||(xyj=='5'))

gotoxjh5;

else

exit(0);

xjh4:

if(strlen(buff1)!

=ma())

sbpri();

else

{}

if(strcmp(buff1,buff2)>0)

{system("cls");

cout<<"请先输入较小的数,再输入较大的数!

!

"<

gotoloop10;}

else

{if((strcmp(buff,buff1)>0)&&(strcmp(buff,buff2)<0))

gotoloop9;}

xjh5:

if(strcmp(buff1,buff)==0)

loop9:

{J=I;

ifstreamifp;

ifp.open("storageC.txt",ios:

:

in);

for(intj=0;j<=I;j++)

{ifp.getline(mes,100);}

cout<

ifp.close();

cout<<"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<

else

loop8:

{s++;

continue;}

}

ifile.close();

if((xyj=='2')||(xyj=='5'))

{if(s<=nn)

loop11:

{if(xyj=='5')

gotoloop15;

smsmss();

cout<<"\n售出(0),返回

(1),返回主菜单

(2)";

cin>>ca;

if(ca=='0')

{loop15:

sell2();

if(xyj=='5')

gotoloop16;

sell1();}

elseif(ca=='1')

ship();

elseif(ca=='2')

main();

else

gotoloop11;}}

else

gotoloop12;

loop12:

if(s>nn)

{system("cls");

cout<<"储存库中没有该货物!

"<

loop5:

charcc;

cout<<"\n继续

(1)返回主菜单

(2)退出系统(0)>:

";

if(xyj=='5')

{loop23:

charp17;

cin>>p17;

if(p17=='0')

exit(0);

elseif(p17=='1')

{Itemclien;

clien.stock1();}

elseif(p17=='2')

main();

else

gotoloop23;}

loop6:

cin>>cc;

if(cc=='1')

{if(xyj=='2')

ship();

elseif(xyj=='4')

Search();}

elseif(cc=='2')

main();

elseif(cc=='0')

exit(0);

else

{cout<<"请重新选择:

";

gotoloop6;}}

else

{gotoloop5;}

loop16:

;}

voidnam()//取需搜索商品名便于与文件读出的格式相同

{stringnam;

cout<<">:

";

cin>>nam;

ifstreamifile;

ofstreamoutfile;

outfile.open("nam.txt",ios:

:

trunc);

outfile<

:

left)<

outfile.close();

ifile.open("nam.txt",ios:

:

in);

ifile.seekg(0,ios:

:

beg);

ifile>>buffer;

ifile.close();

}

voidmain()//主函数

{

system("cls");

system("colorf0");

charc;

cout<<"≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌\n";

cout<<"ΘΘ\n";

cout<<"Θ欢迎使用物品库存管理系统Θ\n";

cout<<"ΘΘ\n";

cout<<"ΘΘ\n";

cout<<"Θ【进货】…

(1)Θ\n";

cout<<"ΘΘ\n";

cout<<"Θ【出货】

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

当前位置:首页 > 工程科技 > 能源化工

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2