




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
C语言课程设计实验报告C语言课程设计实验报告第PAGE8第8页共37页C语言课程设计实验报告一、 目的(本次课设计所涉及并要求掌握的知识点):、:商品信息的添加、修:实现商品浏览功,需要;另外还要提供键盘式选择菜实现功能选择。丿二、使用环境 丿MicrosoftVisualC++三、内容与设计思想丿(l.设计思路2.主要数据结构3.主要代码结构4.丿l、设计思路服装销售系统管理员模块 店长桢块 销售员模块 商品桢块用户添加 商品添加用户删除用户修改
商品删除商品修改商品查找商品浏览2、主要数据结构系统用户结构tyeftyste
User{
商品出售charName20:c釭pasd[20]intuserType;
主键//用户密码//户类型(1管理;2 店长;3销售)tyst
User *next
//指向下一个用户的指针}stesr;/*服装商品信息/typedefstructducts{intproductld:charproduct[20];cproduct[20];charproductCompany[20]:
主键//商品名称//商品型号//商品厂家floatproductPrice;intproductCount;charmemo[50];structProducts*next;}Products;销售记录信息结构/typedefstructSelllnfoRecord{intsaleld:cruserae[];intproductld:intsellCount:int year:intmontint day;charmemo[50]:structSellinfoRecord*next;}SellinfoRecord:
//商品价格//商品数量//商品附加信息//指向下一个商品的指针//销售编号,主键//销售商品的用户名//销售的商品编号//销售数量//销售商品年份//销售商品月份//销售商品日期//销售的附加信息//下一条销售记录3、主要代码结构(一)添加打开文件从键盘输入要添加的信息,若添加的信息与文件里的信息重复,则调用系统暂停函数返回界面;若添加的信息在文件里没有找到,息输入到文件,调用系统暂停函数返回界面。开始昢错误信息勹lL加I将文L加结束(二)查询打开文件从键盘输入要查询的信息若在文件里找到要查询的信息则在界面输入信息并调用系统暂停函数返回界面;若没有找到查询的信息,调用系统暂停函数,返回界面。开始渝出桔淇售息}谝ii找信息开始渝出桔淇售息}调用系坎笞俜凸玫l I 妇 ](三)删除三三i打开文件,从键盘输入要删除的信息,若在文件里找到要删除的信息存在,则把文件里要删除的那条信息删除掉,并调用系统暂停函数,返回界面;若没有找到删除的信息,调用系统暂停函数,三三i开始谝出错误信息调用系抉笞陨迅效,返回结束 (四)修改打开文件,从键盘输入要修改的信息,若在文件里找到要修改的信息存在,则按照提示信息依次输入要修改的信息,写入文件,并调用系统暂停函数,返回界面;若没有找到修改的信息,调用系统暂停函数,返回界面。开始开始悄出错误信息渝入查找信息谕入修改信息修改文件酰系统哲停函数,返回酰系统哲停函数,返回结束4、主要代码段分析对系统进行初始化立用户记记录*voidInitSysteO{FILE*fp:Systeser,bssser,ser;管理店长销售员三个角色信息Productsproducts[2 //初始化两件服装商品信息SellinfoRecordselll2: //初始化两条销售记录//初始化管理员用户名、密码与类型strcpy(adiser.user论“min);strcpy(adiser.pasword,min");adiser.serpe=IIISP:adminUser.next=NULL;打开管理员用户信息文件d
in.txt,写入信息,并关闭文件fp=fopen("Admin.txt","w"):fprintf(fp,"%s\t%s",nUser.userName,aer.d);fclose(fp);AddUser(&adminUser):r(&bossUser);r(ellUser);//添加第一条商品信息strcpy(products[].prodcte,“精品男.strcpy(products[O].productType,"mOOl");strcpy(rodcts[O].rdctopany,“精品服装制),products[O].productPrice=23.5;products[O].productCount=100;strcpy(prodcts[O].eo.“精品男装,您的第一,products[O].next=NULL://添加第二条商品信息strcpy(ductName,”,strcpy(products[l].product"w002");strpy(products[l].rodctpany,”时尚服,products[l].productPrice=25.5;products[l].productCount=150;str(products[lmo.”时尚女装,您的第一,products[l].next=NULL:AddProduct(&products[OJ):AddProduct(&products[1]);//添加第一条销售报表记录selllnfo[O].day=16;strcpy(selllnfo[O].memo,"测试数据1");sellnfo[].onth=7;selllnfo[O.next=selllnfo[O].productld=l;selllnfo[O].sellCount=8;strcpy(selllnfo[O].user,"sell"):selllnfo[O].year=2008:添加第二条销售报表记录selllnfo[l].day=17;y(mo据2");sellnfo[l].onth=7;selllnfo[l].next=NULL:selllnfo[l].productld=2:selllnfo[l].sellCount=5:strcpy(selll[l].erNa,"sell"):selllnfo[l].year=2008:AddSellinfo(&selllnfo[O]);AddSellinfoellinfo[l]);};//添加商品信息voidInputAndAddProduct(){Productsproduct;printf("亲爱的胚 朋友,你好,请依次输入新商品的息,currentUser);//输入商品名称、型号、制作商、价格、数量、附加信息,并把从键盘输入的值赋值给结构体变量的商品名称型号、制作商、价格、数量、附加信息printf;scanf,ductName);printf商品型号scanf("%ductprintf(“商品制造商,scanf("%s",ductCompany):printf商品价格;scanf("%f",&ductice);printfscanf("%d",&ductCount):printf(“商品附加信息”),scanf("%s",product.memo):product.next=NULL;//若成功信息添加到结构体变量product里则提示添加成功if==AddProduct(&productintf商品信息添加成功!\n"):system("pause");//修改商品信息voidModifyProduct(){int productid: //待修改的商品编号stproduct;printf("亲爱的朋友你好你现在进入的商品信息修改功能n",currentser);rintf(“请输入要修改的商品编号,scanf("%d",&productId)://将从键盘接收到的商品编号赋值给变量productidtmpProduct=pProductHead:if(NULL==tmpProduct)return;while(NULL!=tmpProduct){if(productid==tmpProduct->productid){//若从键盘输入的商品编号与文件中的一致,则修改商品信息printf(“商品编号%d的商品信息如下\n",productld);printf(" 商品名称\n",oduct->productName);printf(" 商品型号\n",oduct->productType);printf(" 商品厂家\n",oduct->product;printf(" 商品价格\n",duct->productPrice):printf(" 商品数量n",oduct->productCount);rintf(" 商品附加信息s\n",mpProdct->eo);printf(“下面请对照修改该商品的相应信息\n");printf(“新的商品名称:"),scanf("%s",tmpProduct->productName);printf(“新的商品型号 ”),scanf("%s",t->productType);printf(“新的商品厂家 ”);sca("%s,tmoduct>productny);printf"),scanf("%f",&tmpProduct->productPrice);printf(“新的商品数量 ”),scanf("%d",&tmpProduct->productCount):printf(“新的商品附加信息 ''),saf(%s",mproduct-eo);pritf(“商品信息修改成功!nsyste("pase);break; )t=t//商品删除voidleteProduct()intproductld=0:
duct->next: } };stproductA,*tpProdct:printf("亲爱的朋友,你好,你现在进入的商品删除能,currentUser);printf(“请输入你要删除的商品编号scanf("%d",&productId):prodctA=tproductB=productad; //productB指向要删除的记录,tmpProductA指向前一条记录if(NULL==tmpProductB)return;while(NULL!=tmpProductB){if(tpProduct->productld=rductid){ftroducB=roductead& tpProduct-next{ //如果系统只有一条商品信息free(pProductHead);oductad=printf(“商品信息删除成功!\n");syste(pase);return; }oductA->next=pProductBif(pProductHead==tmpProductB)oductad=oductxt;freepProduct;printf商品信息删除成功;systeme");return; else{tmpProductA=tmpProductB:oductB=oduct>next; } intf对不起不存在该商品编号的信息};//商品查询voidProductFind(){roductstproduct;intfindWay,productld;carrodctae[20);printf("亲爱的朋友,你好,你现在进入的商品查询功能n",currentser);intf(“请选择查询方式 l按商品编号查询 按商品名称查询"),scanf("%d",&find\Vay);tmpProduct=pProductHead;switch(findWay){case1:printf(“请输入查询的商品编号”);scanf("%d",&productId //输入要查询的商品编号while(NULL1=tmpProduct){if(productld==duct-)productid){//若输入查询的商品编号与文件中的一致则输出商品信息rintf(“你查询的商品编号为d的商品信息如下n",rductid);intf(" 商品名称 \n",t-)product);intf(" 商品型号%\n"pProduct>productTypeintf(" 商品厂家:%s\n",tmpProduct->product;intf(" 商品价格 炽,t-)productice);intf(" 商品数量n".切pProduct->productCount);rintf(" 商品附加信息 s\n",mroduct-eo);syste("pause");return; }皿roduct=tpProduct-ext;intf对不起存在该商品编号的商品!\n";systeme");caseprintf(“请输入查询的商品名称"),scanf("%s",productName);//输入要查询的商品名称w加le(NULL!=oduct) {if(0==strcmp(tmpProduct->productName,productName)){//若输入查询的商品名称与文件中的一致,则输出商品信息printf(“你要查询的商品名称为%s的商品信息如下:\n",productName);printf(" 商品名称s\ntprodct-roducta);intf(" :%s\t>productType);printf("商品厂家s\n",tprintf(":f\n",rintf(":\n",t
oduct->productny);pProduct->productPrice);t->productCount);printf(" 商品附加信息s\n",system("pause"):
pProduct->memo):return ; }prodt=tprodt-next; }pritf(“对起不存在该商品编号的商品!");systemuse");default:eak: }}四、调试过程(1.测试数据设计2.测试结果分析初始化用户名与密码管理员ana(一)主界面
店 长:boss boss 销售员:sell sell(二) 以管理员方式登陆系统,输正确的用户账号admin和密码admin若登陆名或密码错误,则提示用户不存在C实验报告C实验报告第PAGE9第9页共37页登陆成功,进入管理员界面,ir',n,1',,广 目曰 l一选择“(l)自身密码修改",修改管理员密码`'!r.l,'圃冒恤咖ll- 血.l-
I,选择“(2)用户信息管理”,进行用户的增、删、改、查功能选择“用户信息查看",查看当前用户信息`1,'I詈国 le ,I,·II
唱一 ·屾用户信,添加用户信息第10页第10页共37页_C语言课程设计实验报告_1•I,·I,············:,产,:··;·····································,圈`'l,',圈`'l,'I',I i 唱 II 选,,,,
`,1,`'「',l\•,,,., ;,I··································,;··:··.'.····;·:·········`1,,'
`'l`1
i1. 匮雪返回管理员界面,选择“(3)商品信息管理”,进行商品的增、删、改、查功能。“用,查看当前商品开 一,.”“'`'呵矗昌`'·:'.········:·············································`It!`I'•.'"""""'1',“I'·'称进行查找。首先选择“按商若查询的编号存在r,,
1'- "'1“'·'·CC第II页第II页共37页若查询的商品绪号不存在,则提示信息“对不起,不存在该商品编号的商品”t飞选择”按商品名称查询",输入正确的商品名称,t飞LinI(I)尸「l
'四一·-!-勹_,古·-
T ~||,LE
-JI+t |7-(2>尸气I二4」.(I心)尸
|」气I口r:荨气I口r(,._一一一中(?)I二,卢~ 1 l;匕=蠡.,-4Hamn什l 1丿 卢勹
-, 今i,一」飞,二,产·口 门1#E3闷—三,l -尸'口卢,三;一,.,门上斗 卢门L3勹一咖七Er卜旦t上I#1_:c,;·1;c--=下门「勹勹t:,'-1:+- +- ',·一2寸L广---.十土二-I-l..,',尸',·一2寸L广---.十土二-I``L二了中:一·,,L二了中:
_t出如1.CE_I”“1i-
「I什I勹 咕「3二乒 _门丁 飞_土.己r了.~土若查询的商品名称不存在,则提示信息对不起不存在该商品编号的商品”选择“商品信息添加“,添加商品信息选择“商品信息修改",修改商品信息CC第PAGE13第13页共37页'.`'1,',','.',',1,国暨血`'i`'『`,忙',',
噜JiJ选,删除商品喟冒瞿止一返回管理员界面,选择“商品报表显示“,进行销售报表功能选择“所有商品销,示商品信息选择“商品日销售报表”,查唔符合条件的销售商品''"'" ',,',,r.,l,',',
,'"",''”“II”“C.. "''”“''"若查 询的信息不符合条则显没符合条件记录选择“商品月销售报表”,查唔符合条件的销售商品选择“销售员销售报表”,查春符合条件的销售商品CC第PAGE14第14页共37页_It""It"",令.:a
'"'···“```',仁”“`*才“' `,(三)以店长方式登录系统选择“自身密码修改",修改店长密码店长其他功能(商品信息管理,销售报表显示)与管理员类似。(四)以销售员登陆系统CC第PAGE15第15页共37页l选择“商品销售”功能,进行产品销售lll—芦I户士一ll(1)f77|'」(l)(4)「(?)尸飞(l)(4)「1庄才1;1-1I「;
勹.'..1iir 叮-r一言,丁1J .,,丁1J
scl昏 暑酮[I...上仁寸二广妇千1-上xj二_广f云1如--之一』.一:2砌8土=_勹'土生百令.?b
忐晶
'凹二生了二- _二二nq言二二-土竺--T'•卢二,:::才}f若销售产品大于库存,则提示销售失败。销售员商品浏览、查询、及报表查看功能与管理员功能类似五、总结..设计中产生的错误及原因分析.六、附录、原代码#include<sth> //标准入输出函#iude.h>//Wi头文件#include<time.h> 日期时间头文件CC第PAGE19第19页共37页#define1#defineBOSS_USER_TYPE2#defineUS3#defineFAI-1#defineFUNCTION_SUCCESS0//如果函数成功执行,将返回0系统用户结构/typedefstructSystemUser{charuserName[20];charpasd[20];int userType;structSystemUser
主键//用户密码用户类型(1管理员;2;3销售员)*next; //指向下一个用户的指针}steer;服装商品信息/typedefstructProductsintproductld;
//商品编号,主键carprodct
e[20];
//商品名称charproductType[20];charproductCompany[20];floatproductPrice;intproductCount;charmo[50];structProducts*next;}Products;销售记录信息结构*typedefstructd{intsaleld;
//商品型号//商品厂家//商品价格//商品数量//商品附加信息//指向下一个商品的指针主键ruser
e[;
//销售商品的用户名intproductld;intsellCount;intyear;intmontintday;charmemo[50];structSellinfoRecord*next;}lIfeord;
//销售的商品编号//销售数量//销售商品年份//销售商品月份//销售商品日期//销售的附加信息//下一条销售记录staticcurrentUser[20];系统全局变量保存当前登陆用户名;staticintcurrentUserType; 保存当前登陆用户的用户类型staticsteer*pSytserad=U;存系统用户信息记录的头指针cs*productad=;/存系统商品信息记录的头指针staticSelllnfoRecordlinfoHead=存系统销售记录的头指针voidInitSyst; //对系统用户信息和商品信息进行初始化intAddUser(SystemUser; //intAddProduct(Products);//向商品信息链表中加入商品信息intinfo(SellinfoRecord*);voidUserExit();voidWelcomeMenu();voidSystinO;
//系统欢迎菜单//系统登陆voidd
iperatior,enuO;
//系统管理员操作菜单voidBosserationMenu();voidSellOperationMenuO;voidChangePasswordO;voidUserManageO;voidUserlnfoViewO;
//店长操作菜单//销售员操作菜单//修改密码//用户信息管理//用户信息查看voidUserInfoAddO;voidUserlnfodify();voidUserlnfoleteO;voidProductsManageO;voidProductsViewO;voidProductFindO;voidInputAndAddProduct():voidModifyProductO;voidDeleteProductO;voidProductsSel1();voidReportPrintO:
//用户信息添加//用户信息修改//用户信息删除//产品信息管理//商品查唔//输入商品信息并添加//修改商品信息//删除商品信息//商品销售//报表显示voidovoid
AllSellport();ySellport():
//显示所有商品销售情况//显示某日的销售情况voidntllRetO:
//显示某月的销售情况voidoE
ployeeSellReportO;
//显示某个销售员的销售情况voidExitSystemO;floatgetPriceByld(int):商品价格
//退出登陆系统//通过商品编号查询intgetroduct商品名称
eByid(int,char*);
//通过商品编号查询intgetCountByld(int);商品库存数量voidReduceProductCount(int,int):商品数量记录和商品记录voidInitSystem(){FILE*fp:
//通过商品编号查询//通过商品编号减少st
erad
inUser,bossUser,seler;
销售员三个角色信息Productsproducts[2];SellinfoRecordselllnfo[2]://管理员
//初始化两件服装商品信息//初始化两条销售记录strcpy(a
inser.user
e,"ad
in");strcpy(a
iser.as
ord,min"):nUser.userType=E:anUser.next=fp=fopen("Admin.txt","w"):frintf(fp,%s\t%s",adfclose(fp)://店长
ier.userName
adminUser.password);strcpy(ossser.userae."oss");strcpy(bossUser.password,"boss");bossUser.erType=bossUser.next=fp=fopen("Shopkeeper.txt","w");fintf(fp,\t%s",bossUser.userName.sUser.d);fclose(fp)://销售员strcpy(lser.userae."sel");y(elser.passord,sel");sellUser.userType=sellUser.next=fp=foen(eler.txt","");frp
intf(fp,\t%s",sellUser.userName.
sellUser.
;fclose(fp);er(er);AddUser(&bossUser);er(&sellUser);//products[O].productId=l;strcpy(prodsO].productName,“,strcpy(products[O].productType,"mOOl"):strcy(products[].productopany,“精品服装制造厂,products[O].productPrice=23.5;products[O].productCount=100;strcpy(productsemo,““),products[O].next=刚LL;//products[!].productld=2:str(products[l].productae,”时尚女装”),strcpy(products[llproductType,"w002");strpy(products[l].rodctpany,”时尚服,products[l].productPrice=25.5;products[!].productunt =150;str(products[lmo,”时尚女装,您的第一,products[!].=NULL:AddProduct(&products[O]):AddProduct(&products[1]);selllnfo[O].day=16;strcpy(selllnfo[O].memo,"测试数据1");sellnfo[O].onth=7;selllnfo[O].=NULL:selllnfo[O].productld=l;selllnfo[O].sellCount=8;stry(selnfo[O].sraselllnfo[O].year=2008:selllnfo[l].=17;
e,"sell");strcpy(sellinfol2");sellnfo[l].onth=7;selllnfo[l].next=!\!\.ILL:selllnfo[l].productld=2;selllnfo[l].sellCount=5:strcpy(selllnfo[l].user,"sell"):selllnfo[l].year=2008;AddSellinfo(&sellinfo[O]):AddSelllnfo(&selllnfo[l]);};/*函数功能:向系统用户信息链表中加入用户信息*intAddUser(SystemUser*pUser){r*pSste
sr,*t
pSystemUser;tmpystsr =ystesrad;while(NULL!=tempSystemUser){if(Ostr
p(tpSst
Usr-sr
e,sr-uer
){printfreturn}tpSyst
ser=t
ter->next; }pSystemUser=(SystemUser*malloc(sizeof(Syst)); 堆空间中分配用户信息的内存if(UL=pystesr){printf“分配用户信息内存时发生错误)returnLED: }strcter->userName,er->user印); //拷贝用户信息到堆空间中strcpy(pSysteser->assord,pser->psor);psteser-sere=ser->usere;pSystemUser->next=pUser->next:tepystser=pSystesera;if(NULL==tempSystemUser){pSystemUserHead=pSystemUser:}else{while(L!=tepystser-ext)到用户信息的最后一条记录tpyste
ser=te
pSystemUser->next:tpSstser-next=pyste}return
User;//将用户信息加入到链表的最后};*函数功能:向商品信息链表中加 入商品信 息*/intAddProduct(Products*pPro){int newProductid=l; //1开始steproduct,*product;tepProdct=pProdctad: 生成编号一件商品编号+1while(L!=tepProduc){oductid=toduct->productid+l;tt=tt->next:}oduct=(Productslloc(sizeof(Products));if(NULL==pProduct){printf对不器添加商品信息时堆内存分配失败!");returnFUNCTION_FAILEO;oduct->productid=oductld: //拷贝商品信息strcpy(pProduct-producte,pPro-rducta);strcpy(pProduct->productType,pPro->product;strcpy(pProdct-rodct
pany,pro-prodct
pany);pProduct->productPrice=pPro->productPrice;pProduct->productCount=pPro->productCount;strcpy(pProdct-o,pPro->pProduct->next=pPro->next;
emo):tepProduct=pProductad: //将商品信息加入到商品信息链表最后if(NULL==tempProduct){pProductHead=pProduct;)else{while(NULL!=tempProduct->next)tempProduct=tempProduct->next;tempProduct->next=pProduct;}returnFUNCTION_SUCCESS:};函数功能:向系统销售信息链表中加入销售信息*intAddSellinfo(SellinfoRecord*pSellinfo){intllinfoldl; 1开始SellInfoRecord*llinfo,llinfoRecord;llinfo=llinfod; while(UL=tpSellnfo){CC第PAGE37第37页共37页newSellinfoid=tmpSellinfo->saleid+l;tmpSellinfo=tmpSellinfo->next;}pSlinfoord=(elinfoord)if(NULL==pSellinfoRecord){
alloc(si乙eof(SellinfoRecord));printf对不起,添加销售记录信息时I");returnFUNC'l、ION_FAILED;pSellInfoRecord->saleld=newSellInfold;pSellinfoRecord-)day=pSellinfo-)day:str(pSelinfoord-)eo,elinfo-o):pelinfoecor-onth=pSlnfo->onth;linfoRecord-)next=info-);linfoRecord->productid=pSellinfo->productld;linfoRecor>sellCount=pSellinfo->sellCount;str(pSelifor->srme,pellnfo-usrlinfoRecord->year=li-)year;
e);tmpSe11Info=pSe11InfoHead;//将销售信息加入到销售记录信息链表最后if(NULL==tmpSellinfo){pSelllnfoHead=pSelllnfoRecord:}else{while(NULL!=llinfo->next)lnfo=li-);tpSelinfo-ext=pSlifocord;)returnFUNCTION_SUCCESS:};系统登/voidSystemLoginO{hruserae[20],passrd[0];intisLogin=0;steUsr *mr;printf(“请输入你的系统用户帐号.f(,sra);printf(“请输入你的系统用户密码:"):scanf("%s",password);血er =terHead;while(UL!=tpUsr) {if(O=str
p
pUser->userName,userName)){if(O==strer->pasd,password))isin=1;strcpy(currentUser,tmer->usere):currentUserType=er->userType;switch(currentUserType){caseAdminOperationMenuO;break;caseBossOperation!llenuO;break;caseSELL_USER_TYPESellOperation!llenuO;break;default:break;else{intf起你输入的密码错误八n");Syste户名正确密码错误}
Login();
//用ser=}
pUser->next;if(isLogin!=1){printf(“对不起该用户不存在n历了所有用户都没有找到用户SystemLoginO;
//遍}}//欢迎界面voidWelcomeMenu(){rintf(“*************服装销售管理系统********************\n");printf(“系统功能说明\n"):intf(" rintf(• (1)密码修改"):printf(" 用户信息管理添加修删除查printf(• (3)商品信息管·添加修查询删");printf(" (4)表"):\n");
printfintf("printf("printf("intf("printf("
;退出系统);店长功能:\n"):)密码修改");商品信息管理添加;intf(" (4;printf(" (5)退出系统:printf(" 销售员功能;printf(" (1)商品浏览;intf(" (2)自己商品销售报表显日销售报表月销售报printf(" 返回主界;i;printf(" (4)退出系统;i;.rintf(“*********************用 本 系 统.*************n”)//管理员界面voidrationMenu(){intselect;while(l){system("cls");printf能n",);printf" (1\n");printf" (2)添加;printf("printf业绩报表n;
商品信息管理添加");)销售报表显示 日报表月报表商品销售量报表销售员printf(" ()返回主界面n");printf(" 退出系统printf(“请翰入上面功能对应的序号进行功能选择“),scanf("%d",&select):switch(select){case1:hangeacontinue;case2:
ord();UserManage():continue;case3:ProductsManageO;continue;case4:ReportPrintO;continue;case5:UserExitO;break;case6:ExitSystem();break;default:break;}if(select==5)break;)//店长界面voidBossOperationMenu(){intselect;while(l){system("cls");printf亲爱的店长%n",):
同志你拥有下面所有功printf(" 自身密码修:printf" (2)添加;printf(" (3)销售报表显示 日报表月报表商品销售量报表销售业绩报表n);printf(" )返回主界面nrintf(" (5)退出系统n");printf(“请翰入上面功能对应的序号进行功能选择“),scanf("%d",&select):switch(se1ect){case1:hangeacontinue;case2:
ord();ProductsManageO;continue;case3:ReportPrintO;continue;case4:UserExitO:break;case5:ExitSystem():break;default:break;}if(select==4)break;.//销售员界面voidSellOperationMenuO{int select;while(l){system("cls");printf(“亲爱的销售员%s同志,欢迎使用本系统,你拥有下面所有功能n",rentsr);printf(" (1商品浏览n;printf(" (2商品查询n;printf(" (3商品销售n;printf(" 4)报表查看n");printf(" (5返回主界面nprintf(" 6)退出系统n;printf(“请输入上面功能对应的序号进行功能选择“),scanf("%d",&select);switch(se1ect) {case1:ProductsViewO;continue;case2:ProductFindcontinue;case3:ProductsSellO;continue;case4:ReportPrintO;continue;case5:UserExitO:break;case6:ExitSystemObreak;default:break;}if(select==5)break;};//更改密码voidChangePasswordO{chardl[20],rd2[20]:SystemUser*tmpUser;rintf((*********************************************************\n"):rintf(“请输入你的新密码,scanf("%s",newPasswordl);rintf(“请再次输入你的新密码),scanf("%s",newPassword2):if(0!=strcmp(newPasswordl,newPassword2)){intf对不起你两次输入的密码不一致;return:sr =stesrad;while(UL=tpser) {if(O==strcmp(tmpUser->userName,currentUser))strcytsr->sord,ordl);printf(“密码修改成功!\n");syste("ase):`4brea`4切pser=t)//用户信息管理功能voidUserOintselect;while(l){
pUser->next:system("cls");printf“亲爱的管理s同志你目前进入的是用户信息管理功能:\n",currentUser);intf" (1):printf" (2);printf" (3\n");intf" ):printf" (5)):printf" (6)退出登陆系统;printf(“请输入上面功能对应的序号进行功能选择“).scanf("%d",&select);switch(select){ case1:UserinfoVicontinue;case2:
();UserinfoAdd()continue;case3:UserinfoModify():continue;case4:UserinfoleteO;continue;case5:tiu();eak;case6:ExitSystem();break;default:break;} }};//商品信息查看voidProductsViweO{Products*tmpProduct;inti;i=1;血pProduct=pProductHead:if(NULL==tmpProduct)printf“对不起前还没有;else{while(NULL!=tmpProduct){printf("*********************************************************\n"):rintf“d件下1",);printf(“商品号 d\n",tproduct->productid);printf(“商名称 \n",oduct->productName):printf(“商型号\n",oduct->product;printf(“商品厂家s\n",
product->product
pany);printf(“商品价格\n"t>productPriceintf商品数量%n"oductproduct);rintf“商品加信息 s\n",mrodt->tmpProduct=t->next:i++;}
o);system("pause");}};//产品销售功能voidProductsSell(){SellinfoRecordselllnfo:printf(f"*********************************************************\n"):intf(“亲爱的销售员朋友%,你好你现在进入的是产品的销售功能n",curresr);printf(“请依次翰入以下销售信息\n");printf(“销售的产品编号).sca("%d&selllnfoproductId);printf(“销售的产品数量,scanf("%d"&sellinfosellCount;if(selll.sellCount>getCountById(ductId)){printf对不起你输入的销 售数蜇大于库存销售失败n");system("pause");return;)strpy(selInfo.user
e.currentUser);printf(“销售商品所在年份').scanf("%d",&selllnfo.year);printf(“销售商所,f(,lInf.nth);printf(“销售商品所在号数,scanf("%d",&selllnfo.day);printf(“销售商品的附加信息,scanf("%s",sellInfo.memo);sellInfo.t=if(FUNCTION_SUCCESS==AddSelllnfo(&sellinfo)){printf(“商品销售成功八n");system("pause");educePrductount(selInfo.prductld,lInf.lount);.};.//商品管理功能voidProductsMaO{int select;while(l){system("cls");printf你现在进入的是商品管理功能下:\n"currentUser);printf(" (1)商品信息查春;printf(" (2商品信息查找n"):printf(" (3商品信息添加n"):printf(" (4商品信息修改n");printf(" (5商品信息删除n"):printf(" (6)返回上级菜单n"):printf(" 退出登陆系统;printf“请选择应的操作编号scanf&select:switch(select){case1:ProductsViewO;continue;case2:ProductFindOcontinue;case3:Inputoduct()continue;case4:勋difyProductO;continue;case5:leteProductOcontinue;case6:switch(currentUserType){caseAdminOperation!\lenuO;break;caseBOSS_USER_TYPEBossOperationMenuO;break;caseSELL_USER_TYPE:SellOperationMenu();break:default:break;break;case7:ExitSystem():break;defaultbreak;} }};//添加商品信息voidInputoductProductsproduct;printf(f"*********************************************************\n");printf("亲爱的朋友,你好,请依次输入新商品的信息n",rentsr):printf(“商品名称"),f%s",product.rodctprintf(“"),
e);scanf("%ductprintf(“商品制造商,scanf("%sproductproductny):printf;scanf,&ductPrice);printf(“商品数量"),scanf("%d&ductCountrintf(“商品附加信息;scanf",product.memo):product.next=NULL;if==AddProduct(&productintfsystem("pause");};//更改商品信息voidModifyProduct(){int productld: //待修改的商品编号stproduct;printf(**********************************n”);*********printf("亲爱的给 朋友你好你现在进入的商品信息修改功能currentUser);printf(“请输入要修改的商品编号).scanf,&productId):tmpProduct =oductd;if(NULL==tmpProduct)return;while(L!=tpProduc) {if(productld==tmpProduct->productld){printf(“商品编号%d的商品信息如下\n",productld);printf(" \n"tmpProduct>productName):printf(" 商品型号\n",tmpProduct-)productType);printf(" 商品厂家\n",oduct->product;intf(" 商品价格\n",oduct->productice):printf(" 商品数量n",tmpProduct-)productCount);printf(" 品:%s\n",tmpProduct-;printf(“下面请对照修改该商品的相应信息;intf(“新的商品名称 "),scanf("%s",tmpProduct->productName);intf(“新的商品型号 scanf("%s",tmpProduct-)productType);printf(“新的商品厂家:"),scanf("%s",tmpProduct->productny);intf(“新的商品价格 ”),sanf(%f",tpProduc->productri):printf(“新的商品数量 sca("%d",&tmpProduct->productCount);printf“新的商品附加信息 ),scanf"%stmpProduct:intf商品信息修改成功八n");syste("ase):}};
break:=
pProduct->next://商品信息查找voidProductFind(){Products*tmpProduct;int findWay,producticrrodctae[20);f("****************************************************\n"):printf("亲爱的朋友,你好,你现在进入的商品查询功能:\n",currentUser):printf(“请选择查询方式 l--商品编号查询 按商品名称查询"),scanf("%d",&findWay);tmpProduct =oductd:tch(fiy)case1:printf(“请轮入查询的商品编号”),scanf("%cl",&productId);while(NULL!=tmpProduct){if(productld==tmpProduct->productid){printf“你查询的商d的商品信息如下n",roductid);printf(" 商品名称 s\n",tpProdct-)prodta):printf(" 商品型号 \n",t->productType);printf(" 商厂家 \n",oduct->product;printf(" 商品价格\n",duct-)tPrice);printf(" 商品数量n",t->productCount);printf(" 商品附加信息s\n",mpProduct-mse"):return:
o);pProdt=tprodct-next;printf(“对不起不存在该商品编号的商品!n;systpause");caseprintf(“请输入查询的商品名称";scanf("%s",productName);while(NULL1=tmpProduct){f(0=strc
pt
product->product
e,product
e)){printf(“你要查询的商品名称为%s的商品信息如下\n".productName);printf" 商品名称 s\n",
pProduct->product
e);printf(" 商品型号s\n",tprintf(" 商品厂家%s\n",
duct->productType);pProduct-)productCompany);intf \n",tmpProductproductPriceprintf(" 商品数量 d\n",tproduct->prodtunt);printf(" 商品附加信息s\n",pProduct-system("pause");return;
emo);皿pProdut =}
pProduct->next;printf(“对不起存在该商品编号的商品!n:systedefault
("pause"):break:}}//删除商品voidleteProduct(){intproductld=0;Products*tmpProductA,*tmpProductB;printf((*********************************************************\n");intf("亲爱的朋友,你好,你现在进入的商品删除功能,currentUser);printf(“请输入你)scanf("%cl",&productId);pProductA=tpctB=productead; //tproductB指向要删除的记tproductA指向前一条记录if(NULL==tmpProductB)return;while(NULL!=tmpProductB){if(t
pProductB->productld==productid){if(tmpProductB==oductHead&& tmpProductB->next){ 如果系统只有一条商品信息freeoductd);pProductd=NULL;printf(“商品信息删除成功!\n");sste(ause");return;product->next=tpProduct-next;if(pProductHead==tmpProductB)productad=tpProduct-ext;free(oductB):printf(“商品信息删除成功!\n");syste("pause):return:}else{tmpProductA=tmpProductB:tmpProductB=tmpProductB->next;* }printf(“对不起,不存在该商品编号的信息!");};//销售报表功能voidReportPrintO{intselect=0:ifE!=currentUserType){while(l){system("cls"):printf(“亲爱的朋友%s,你好,你现在进入的是销售报表功能界面:\n",currentUser):printf(" (1)所有商品销售情况printf(" (2)商品日销售报表:printf(" 商品月销售报表;printf (4)销售员销售报表");pritf(" (5)返回上级菜单npr
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025至2030年中国浮箱链轨式沼泽车数据监测研究报告
- 个案工作介入重症儿童心理困境改善服务的应用研究
- 合成生物学知识的伦理研究
- 北京商业房屋租赁合同范本
- 产品赠与合同范本
- 华阳股合同范本
- 卤制品加盟合同范本
- 基于标签分布的回归噪声过滤方法研究
- 合作种植协议合同范本
- 2025至2030年中国塑料挡光板数据监测研究报告
- 输血与创伤性凝血病
- 消化科临床重点专科
- 人工挖孔桩爆破技术方案
- 2023年牡丹江大学单招面试题库及答案解析
- 手机号码归属地
- 运行程序etops二放手册b787qrh快速检查单
- MT 220-1990煤矿用防爆柴油机械排气中一氧化碳、氮氧化物检验规范
- GB/T 5824-2021建筑门窗洞口尺寸系列
- GB/T 30795-2014食品用洗涤剂试验方法甲醇的测定
- GB/T 26148-2010高压水射流清洗作业安全规范
- GB/T 1345-2005水泥细度检验方法筛析法
评论
0/150
提交评论