productcppWord格式.docx

上传人:b****6 文档编号:22151732 上传时间:2023-02-02 格式:DOCX 页数:14 大小:16.03KB
下载 相关 举报
productcppWord格式.docx_第1页
第1页 / 共14页
productcppWord格式.docx_第2页
第2页 / 共14页
productcppWord格式.docx_第3页
第3页 / 共14页
productcppWord格式.docx_第4页
第4页 / 共14页
productcppWord格式.docx_第5页
第5页 / 共14页
点击查看更多>>
下载资源
资源描述

productcppWord格式.docx

《productcppWord格式.docx》由会员分享,可在线阅读,更多相关《productcppWord格式.docx(14页珍藏版)》请在冰豆网上搜索。

productcppWord格式.docx

请输入你想要提取商品的名字"

endl;

cin>

>

name;

system("

cls"

);

if(head!

=NULL)

do

p=head;

head=head->

next;

}while(p->

name!

=name);

请输入存入的数量"

o;

j=p->

quantity;

p->

quantity=(j+o);

}

voidextract(student*head)//*提取功能*//

intl,j;

'

'

"

你想要提取的商品为:

name<

库存量为:

quantity<

请输入你想要提取的商品的数量"

l;

if(l>

(p->

quantity))

................................................"

库存不够"

请重新输入你想提取的数量,请不要超过库存量"

请注意库存量为"

请输入:

提取成功"

quantity=(j-l);

库存剩余量为"

else

l=p->

quantity=(p->

quantity-l);

}

boolcheck(stringstr)//*判断输入*//

for(inti=0;

i<

str.length();

i++)

if((str[i]<

0'

||str[i]>

9'

)&

&

(str[i]!

='

.'

))

returnfalse;

returntrue;

student*create()

student*p1,*p2;

p1=newstudent;

head=p1;

p2=p1;

stringstr;

cout<

请输入商品的编号"

cin>

str;

while(!

check(str))

输入错误,请重新输入数字编号"

p1->

numble=atoi(str.c_str());

if(p1->

numble!

=0)

请输入商品的名字:

p1->

请输入商品的价格"

输入错误,请重新输入价格"

price=atoi(str.c_str());

请输入要存入的数量"

while(!

输入错误,请重新输入存入数量"

quantity=atoi(str.c_str());

请输入商品的存储日期"

输入错误,请重新输入年份"

year=atoi(str.c_str());

输入错误,请重新输入月份"

month=atoi(str.c_str());

输入错误,请重新输入day"

day=atoi(str.c_str());

请输入商品的产地"

place;

system("

else

deletep1,p2=NULL,p2->

next=NULL,head=NULL;

returnhead;

while(p1->

p2=p1;

p1=newstudent;

请输入商品的编号:

输入0代表退出存储功能"

p2->

next=p1;

deletep1,p2->

next=NULL;

returnhead;

voidinsert(student*head)

{

intnum=0;

stringname;

student*p=NULL;

student*l;

p=newstudent;

while(head)

l=head;

}

l->

next=p;

p->

请输入插入的内容:

请输入商品的名字"

numble;

price;

year;

month;

day;

添加成功"

voiddeletenode(student*head)//*删除功能*//

student*l=NULL;

intnum;

请输入你想删除的编号"

num;

if(head->

numble==num)

l=head;

head=head->

:

head=head;

deletel;

return;

while(head!

if(head->

next==NULL)

没找到要删除的编号"

return;

next->

l=head->

head->

next=l->

成功删除"

voidshow(student*beginhead)//*显示功能*//

student*p=beginhead;

if(beginhead!

商品的编号为:

numble<

商品的名字为:

商品的价格为:

price<

商品的产地为:

place<

商品的库存数量为:

商品的存储日期为:

year<

-'

month<

day<

......................................."

p=p->

此链表为空"

deletep;

while(p!

=NULL);

voidsearch(student*head)//*查询*//

intnum;

student*p;

请输入你想查找的编号:

while(head)

没找到要查询的编号"

商品的名字为;

商品编号为:

商品的产地为:

intmain()//*系统入口主函数*//

inti,k;

欢迎进入仓库管理系统"

............................."

1代表存储商品基本信息."

2代表删除商品基本信息."

3代表显示所有商品信息."

4代表查询商品基本信息."

5代表添加商品基本信息."

6代表提取商品."

7代表增加已有商品的存储量"

请选择功能:

;

i;

switch(i)

case1:

head=create();

break;

case2:

deletenode(head);

case3:

show(head);

case4:

search(head);

case5:

insert(head);

case6:

extract(head);

case7:

addgoods(head);

是否继续选择功能?

1代表是,0代表否"

按1将自动跳转回功能选择界面"

k;

while(k!

=0);

return0;

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

当前位置:首页 > 高等教育 > 农学

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

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