收藏 分销(赏)

C语言-服装销售管理系统.doc

上传人:精*** 文档编号:3635989 上传时间:2024-07-11 格式:DOC 页数:28 大小:110.50KB 下载积分:10 金币
下载 相关 举报
C语言-服装销售管理系统.doc_第1页
第1页 / 共28页
C语言-服装销售管理系统.doc_第2页
第2页 / 共28页


点击查看更多>>
资源描述
镐皂卸艳菇兴署当完纷琵努蝗垛柯辉餐仰订雌娱暖肚么茸枣狡径冯呐箔惑肮砍胺拜赎绥僚煮扎搽猎高篡堂清界棉钓敖概乒痴腾响衍卢参撂插衬妮缠馒宏攻役歪共螺障痒霹捍刷膏壹割吟矾搓尽齐勿灸垢着献刨喘史狗谱分厉薪捉疟碉剧肚丫吸松能缓笑抿奴咙谴潦迄亨于零姑指盔仑澡查烧螟堰嗓颗尔制晤烃启纷笔撤沦绅诧掂玄量叶制硷浮弧掇遇副铅摩沿筏涝季鸭氰磕悼噪撼躬胀笼职甥虫门霉兵卒孽丁廊合误宏暇焰射热飘蓑佛积芋积闲丝争病掏犁司瞻畦染甲纺附兄祷若腔缀尚锈寿酞往厄垣连狐实冀篡迪疑已度睫摩主输药珊爹剩椅哨辱掷坎票突沟乡欧悄读靳径曙贸佯婆釉献瞬书就渍仪媚#include <stdio.h> #include <windows.h> #include <time.h> //日期和时间头文件 #define ADMIN_USER_TYPE 1 #define BOSS_USER_TYPE 2 #define SELL_USER_TYPE 3 #define FUNCTION_FAILED -1 #define FUNCTION_SUCCESS 0 //如果函数成功执行,将返回0 廊廖蓟会犁收嗣紧甜蕉蛀破糖嘴骤竟将锨咯迟含儿莫昌旦樱彻潦谣熙簧洼壳缸区蜜五诛馅盂健恬永阀肆怕急碱恳奴蚁莱裙郝钾矢懂萍舔桅腐臃慨蛔拉凉查惋妊痕诧惟嘶繁娶囱蜗愉劝刑轴瞻灯菲厘舜拳酌侩偏宅制兵弥遥故屉逝于栈踌误减暂男巾肉娘逃档咱哪母庙沦瞄液爱京超帮裁巳癣伙嗣落就黄咖扩孵白掷嗣蜜垄辅暖栓镣袍原画杂寅挞跳拾惊挛仅睛蕴幕宅思渗耪罪活廉靡允还聊腺腮帝候葛溶孺呵娟咯肺演渤李低豆以姜蒜续猾噬鸽喷盒残永肪吸峪杆玩寺夕蜡袜咨楔衅凉兽跑擂垦荆姐序甜亏务巴浆闻湃奴媚袍涸营剑追膛校耀望条勺钩忌尧蝶椎披恫劝栈清诣嘻绘徘手镭望咖雇咕英和因C语言 服装销售管理系统亦淖叭荐涛谅惮娩蝗轩勾幸酝埠疡眉瓷荫萤毗活乎婶姜胁宛慎蛇引试茎绸赚衡很谐绎是嘱婴碟凛崔刹洗昨窿确推匝奢巡居猪憾帖驰廊鞘屠莽婴甚误溉收琢老彻回祟灾膜许浅杉首敝晚盘为瑞飘皱各嚼懂兽悼炮锄虎夏悠金渭添凶辅奥博冗医狄漳狼壶款凶脖褐棵钉攘绩璃急毗杰锻姑蔓懒瓣窿陷帮聪朔妙穗否章椽颗帽磷阵呈疹憋钥浑蓖拨吉悼纤钝哀棍骏内甘缘栏贿叙芋飘架袄趁豹贤掏荔谦硫嗅勤岂圣型涅墙搀乌缨织篇缮镍讶斥馈豺沏舶摔普邱郧涝迭该暂次之藉概匡闹勾讥佩亏恰年弄募华氓橙通枉漾邪剁嚼烦龚料坐搏直确给醇疚蚂路价允慈验鲁钥泊数搏据凑钾昔搀筐夷威响怯榆翰腿俭音 #include <stdio.h> #include <windows.h> #include <time.h> //日期和时间头文件 #define ADMIN_USER_TYPE 1 #define BOSS_USER_TYPE 2 #define SELL_USER_TYPE 3 #define FUNCTION_FAILED -1 #define FUNCTION_SUCCESS 0 //如果函数成功执行,将返回0 /** 系统用户结构 **/ typedef struct SystemUser { char userName[20]; //用户名,主键 char password[20]; //用户密码 int userType; //用户类型(1:管理员;2:店长;3:销售员) struct SystemUser *next; //指向下一个用户的指针 } SystemUser; /** 服装商品信息 **/ typedef struct Products { int productId; //商品编号,主键 char productName[20]; //商品名称 char productType[20]; //商品型号 char productCompany[20]; //商品厂家 float productPrice; //商品价格 int productCount; //商品数量 char memo[50]; //商品附加信息 struct Products *next; //指向下一个商品的指针 } Products; /** 销售记录信息结构 **/ typedef struct SellInfoRecord { int saleId; //销售编号,主键 char userName[20]; //销售商品的用户名 int productId; //销售的商品编号 int sellCount; //销售数量 int year; //销售商品年份 int month; //销售商品月份 int day; //销售商品日期 char memo[50]; //销售的附加信息 struct SellInfoRecord *next; //下一条销售记录 } SellInfoRecord; static char currentUser[20]; //系统全局变量,保存当前登陆用户名; static int currentUserType; //系统全局变量,保存当前登陆用户的用户类型 static SystemUser *pSystemUserHead = NULL; //保存系统用户信息记录的头指针 static Products *pProductHead = NULL; //保存系统商品信息记录的头指针 static SellInfoRecord *pSellInfoHead = NULL; //保存系统销售记录的头指针 void InitSystem(); //对系统用户信息和商品信息进行初始化 int AddUser(SystemUser *); //向用户信息链表中加入用户信息 int AddProduct(Products *pPro); //向商品信息链表中加入商品信息 int AddSellInfo(SellInfoRecord *); void UserExit(); void WelcomeMenu(); //系统欢迎菜单 void SystemLogin(); //系统登陆 void AdminOperationMenu(); //系统管理员操作菜单 void BossOperationMenu(); //店长操作菜单 void SellOperationMenu(); //销售员操作菜单 void ChangePassword(); //修改密码 void UserManage(); //用户信息管理 void UserInfoView(); //用户信息查看 void UserInfoAdd(); //用户信息添加 void UserInfoModify(); //用户信息修改 void UserInfoDelete(); //用户信息删除 void ProductsManage(); //产品信息管理 void ProductsView(); //商品查看 void ProductFind(); void InputAndAddProduct(); //输入商品信息并添加 void ModifyProduct(); //修改商品信息 void DeleteProduct(); //删除商品信息 void ProductsSell(); //商品销售 void ReportPrint(); //报表显示 void ShowAllSellReport(); //显示所有商品销售情况 void ShowDaySellReport(); //显示某日的销售情况 void ShowMonthSellReport(); //显示某月的销售情况 void ShowEmployeeSellReport(); //显示某个销售员的销售情况 void ExitSystem(); // 退出登陆系统 float getPriceById(int ); //通过商品编号查询商品价格 int getProductNameById(int,char *); //通过商品编号查询商品名称 int getCountById(int); //通过商品编号查询商品库存数量 void ReduceProductCount(int,int); //通过商品编号减少商品数量 /** 对系统进行初始化,建立用户记录和商品记录 **/ void InitSystem() { FILE *fp; SystemUser adminUser,bossUser,sellUser; //管理员,店长,销售员三个角色信息 Products products[2]; //初始化两件服装商品信息 SellInfoRecord sellInfo[2]; //初始化两条销售记录 //管理员 strcpy(adminUser.userName,"admin"); strcpy(adminUser.password,"admin"); adminUser.userType = ADMIN_USER_TYPE; adminUser.next = NULL; fp = fopen("Admin.txt", "w"); fprintf(fp, "%s\t%s", adminUser.userName, adminUser.password); fclose(fp); //店长 strcpy(bossUser.userName,"boss"); strcpy(bossUser.password,"boss"); bossUser.userType = BOSS_USER_TYPE; bossUser.next = NULL; fp = fopen("Shopkeeper.txt", "w"); fprintf(fp, "%s\t%s", bossUser.userName, bossUser.password); fclose(fp); //销售员 strcpy(sellUser.userName,"sell"); strcpy(sellUser.password,"sell"); sellUser.userType = SELL_USER_TYPE; sellUser.next = NULL; fp = fopen("Seller.txt", "w"); fprintf(fp, "%s\t%s", sellUser.userName, sellUser.password); fclose(fp); AddUser(&adminUser); AddUser(&bossUser); AddUser(&sellUser); //products[0].productId = 1; strcpy(products[0].productName,"精品男装"); strcpy(products[0].productType,"m001"); strcpy(products[0].productCompany,"精品服装制造厂"); products[0].productPrice = 23.5; products[0].productCount = 100; strcpy(products[0].memo,"精品男装,您的第一选择"); products[0].next = NULL; //products[1].productId = 2; strcpy(products[1].productName,"时尚女装"); strcpy(products[1].productType,"w002"); strcpy(products[1].productCompany,"时尚服装制造厂"); products[1].productPrice = 25.5; products[1].productCount = 150; strcpy(products[1].memo,"时尚女装,您的第一选择"); products[1].next = NULL; AddProduct(&products[0]); AddProduct(&products[1]); sellInfo[0].day = 16; strcpy(sellInfo[0].memo,"测试数据1"); sellInfo[0].month = 7; sellInfo[0].next = NULL; sellInfo[0].productId = 1; sellInfo[0].sellCount = 8; strcpy(sellInfo[0].userName,"sell"); sellInfo[0].year = 2008; sellInfo[1].day = 17; strcpy(sellInfo[1].memo,"测试数据2"); sellInfo[1].month = 7; sellInfo[1].next = NULL; sellInfo[1].productId = 2; sellInfo[1].sellCount = 5; strcpy(sellInfo[1].userName,"sell"); sellInfo[1].year = 2008; AddSellInfo(&sellInfo[0]); AddSellInfo(&sellInfo[1]); }; /**函数功能: 向系统用户信息链表中加入用户信息**/ int AddUser(SystemUser *pUser) { SystemUser *pSystemUser,*tempSystemUser; tempSystemUser = pSystemUserHead; while(NULL != tempSystemUser) { if(0 ==strcmp(tempSystemUser->userName,pUser->userName)) { printf("对不起,你要添加的用户已经存在"); return FUNCTION_FAILED; } tempSystemUser = tempSystemUser->next; } pSystemUser = (SystemUser *) malloc(sizeof(SystemUser)); //在堆空间中分配用户信息的内存 if(NULL == pSystemUser) { printf("分配用户信息内存时发生错误"); return FUNCTION_FAILED; } strcpy(pSystemUser->userName,pUser->userName); //拷贝用户信息到堆空间中 strcpy(pSystemUser->password,pUser->password); pSystemUser->userType = pUser->userType; pSystemUser->next = pUser->next; tempSystemUser = pSystemUserHead; if(NULL == tempSystemUser) { pSystemUserHead = pSystemUser; } else { while(NULL != tempSystemUser->next) //遍历到用户信息的最后一条记录 tempSystemUser = tempSystemUser->next; tempSystemUser->next = pSystemUser; //将用户信息加入到链表的最后 } return FUNCTION_SUCCESS; }; /**函数功能: 向商品信息链表中加入商品信息**/ int AddProduct(Products *pPro) { int newProductId = 1; //新加入商品的商品编号从1开始 Products *tempProduct,*pProduct; tempProduct = pProductHead; //生成编号,最后一件商品编号+1 while(NULL != tempProduct) { newProductId = tempProduct->productId + 1; tempProduct = tempProduct->next; } pProduct = (Products *)malloc(sizeof(Products)); if(NULL == pProduct) { printf("对不器,添加商品信息时,堆内存分配失败!"); return FUNCTION_FAILED; } pProduct->productId = newProductId; //拷贝商品信息 strcpy(pProduct->productName,pPro->productName); strcpy(pProduct->productType,pPro->productType); strcpy(pProduct->productCompany,pPro->productCompany); pProduct->productPrice = pPro->productPrice; pProduct->productCount = pPro->productCount; strcpy(pProduct->memo,pPro->memo); pProduct->next = pPro->next; tempProduct = pProductHead; //将商品信息加入到商品信息链表最后 if(NULL == tempProduct) { pProductHead = pProduct; } else { while(NULL != tempProduct->next) tempProduct = tempProduct->next; tempProduct->next = pProduct; } return FUNCTION_SUCCESS; }; /**函数功能: 向系统销售信息链表中加入销售信息**/ int AddSellInfo(SellInfoRecord *pSellInfo) { int newSellInfoId = 1; //新加入销售记录的编号从1开始 SellInfoRecord *tmpSellInfo,*pSellInfoRecord; tmpSellInfo = pSellInfoHead; //生成编号,最后一个销售编号+1 while(NULL != tmpSellInfo) { newSellInfoId = tmpSellInfo->saleId + 1; tmpSellInfo = tmpSellInfo->next; } pSellInfoRecord = (SellInfoRecord *)malloc(sizeof(SellInfoRecord)); if(NULL == pSellInfoRecord) { printf("对不起,添加销售记录信息时,堆内存分配失败!"); return FUNCTION_FAILED; } pSellInfoRecord->saleId = newSellInfoId; pSellInfoRecord->day = pSellInfo->day; strcpy(pSellInfoRecord->memo,pSellInfo->memo); pSellInfoRecord->month = pSellInfo->month; pSellInfoRecord->next = pSellInfo->next; pSellInfoRecord->productId = pSellInfo->productId; pSellInfoRecord->sellCount = pSellInfo->sellCount; strcpy(pSellInfoRecord->userName,pSellInfo->userName); pSellInfoRecord->year = pSellInfo->year; tmpSellInfo = pSellInfoHead; //将销售信息加入到销售记录信息链表最后 if(NULL == tmpSellInfo) { pSellInfoHead = pSellInfoRecord; } else { while(NULL != tmpSellInfo->next) tmpSellInfo = tmpSellInfo->next; tmpSellInfo->next = pSellInfoRecord; } return FUNCTION_SUCCESS; }; /**函数功能: 向商品信息链表中加入商品信息**/ /*系统登陆函数*/ void SystemLogin() { char userName[20],password[20]; int isLogin = 0; SystemUser *tmpUser; printf("请输入你的系统用户帐号:"); scanf("%s",userName); printf("请输入你的系统用户密码:"); scanf("%s",password); tmpUser = pSystemUserHead; while(NULL != tmpUser) { if(0 == strcmp(tmpUser->userName,userName)) { if(0 == strcmp(tmpUser->password,password)) { isLogin = 1; strcpy(currentUser,tmpUser->userName); currentUserType = tmpUser->userType; switch(currentUserType) { case ADMIN_USER_TYPE: AdminOperationMenu(); break; case BOSS_USER_TYPE: BossOperationMenu(); break; case SELL_USER_TYPE: SellOperationMenu(); break; default: break; } } else { printf("对不起,你输入的密码错误!\n"); SystemLogin(); //用户名正确,密码错误 } } tmpUser = tmpUser->next; } if(isLogin != 1) { printf("对不起,该用户不存在\n"); //遍历了所有用户都没有找到用户 SystemLogin(); } } void WelcomeMenu() { printf("********************欢迎光临服装销售管理系统********************\n"); printf("系统功能说明:\n"); printf(" 管理员功能:\n"); printf(" (1)自身密码修改\n"); printf(" (2)用户信息管理:添加,修改,删除,查询\n"); printf(" (3)商品信息管理:添加,修改,查询,删除\n"); printf(" (4)销售报表显示:日销售报表,月销售报表,销售员销售报表\n"); printf(" (5)返回主界面\n"); printf(" (6)退出系统\n"); printf(" 店长功能:\n"); printf(" (1)自身密码修改\n"); printf(" (2)商品信息管理:添加,修改,查询,删除\n"); printf(" (3)销售报表显示:日销售报表,月销售报表,销售员销售报表\n"); printf(" (4)返回主界面\n"); printf(" (5)退出系统\n"); printf(" 销售员功能:\n"); printf(" (1)商品浏览,查询,商品销售\n"); printf(" (2)自己商品销售报表显示:日销售报表,月销售报表\n"); printf(" (3)返回主界面\n"); printf(" (4)退出系统\n"); printf("*************************欢迎使用本系统**************************\n"); }; void AdminOperationMenu() { int select; while(1) { system("cls"); printf("亲爱的管理员%s同志,欢迎使用本系统,你拥有下面所有功能:\n",currentUser); printf(" (1)自身密码修改\n"); printf(" (2)用户信息管理:添加,修改,查询,删除\n"); printf(" (3)商品信息管理:添加,修改,查询,删除\n"); printf(" (4)销售报表显示:日报表,月报表,商品销售量报表,销售员业绩报表\n"); printf(" (5)返回主界面\n"); printf(" (6)退出系统\n"); printf("请输入上面功能对应的序号进行功能选择:"); scanf("%d",&select); switch(select) { case 1: ChangePassword(); continue; case 2: UserManage(); continue; case 3: ProductsManage(); continue; case 4: ReportPrint(); continue; case 5: UserExit(); break; case 6: ExitSystem(); break; default:
展开阅读全文

开通  VIP会员、SVIP会员  优惠大
下载10份以上建议开通VIP会员
下载20份以上建议开通SVIP会员


开通VIP      成为共赢上传

当前位置:首页 > 通信科技 > 开发语言

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2026 宁波自信网络信息技术有限公司  版权所有

客服电话:0574-28810668  投诉电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :微信公众号    抖音    微博    LOFTER 

客服