




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
編號:時間:2021年x月x日書山有路勤為徑,學(xué)海無涯苦作舟頁碼:第頁C語言課程設(shè)計實驗報告目的(本次課程設(shè)計所涉及并要求掌握的知識點。)用戶與商品信息要采用文件存儲,因而要提供文件的輸入輸出操作;實現(xiàn)用戶的添加、修改、刪除;商品信息的添加、修改、刪除、查找等功能;實現(xiàn)商品瀏覽功能的實現(xiàn),需要實現(xiàn)顯示操作;另外還要提供鍵盤式選擇菜單以實現(xiàn)功能選擇。二、使用環(huán)境(本次上機實踐所使用的平臺和相關(guān)軟件。)MicrosoftVisualC++三、內(nèi)容與設(shè)計思想(1.設(shè)計思路2.主要數(shù)據(jù)結(jié)構(gòu)3.主要代碼結(jié)構(gòu)4.主要代碼段分析。)1、設(shè)計思路服裝銷售系統(tǒng)服裝銷售系統(tǒng)管理員模塊店長模塊銷售員模塊商品模塊用戶添加用戶刪除用戶修改商品添加商品刪除商品修改商品查找商品瀏覽商品出售2、主要數(shù)據(jù)結(jié)構(gòu)/**系統(tǒng)用戶結(jié)構(gòu)**/typedefstructSystemUser{charuserName[20];//用戶名,主鍵charpassword[20];//用戶密碼intuserType;//用戶類型(1:管理員;2:店長;3:銷售員)structSystemUser*next;//指向下一個用戶的指針}SystemUser;/**服裝商品信息**/typedefstructProducts{intproductId;//商品編號,主鍵charproductName[20];//商品名稱charproductType[20];//商品型號charproductCompany[20];//商品廠家floatproductPrice;//商品價格intproductCount;//商品數(shù)量charmemo[50];//商品附加信息structProducts*next;//指向下一個商品的指針}Products;/**銷售記錄信息結(jié)構(gòu)**/typedefstructSellInfoRecord{intsaleId;//銷售編號,主鍵charuserName[20];//銷售商品的用戶名intproductId;//銷售的商品編號intsellCount;//銷售數(shù)量intyear;//銷售商品年份intmonth;//銷售商品月份intday;//銷售商品日期charmemo[50];//銷售的附加信息structSellInfoRecord*next;//下一條銷售記錄}SellInfoRecord;3、主要代碼結(jié)構(gòu)(一)添加打開文件,從鍵盤輸入要添加的信息,若添加的信息與文件里的信息重復(fù),則調(diào)用系統(tǒng)暫停函數(shù),返回界面;若添加的信息在文件里沒有找到,則將添加的信息輸入到文件, 調(diào)用系統(tǒng)暫停函數(shù),返回界面。查詢打開文件,從鍵盤輸入要查詢的信息,若在文件里找到要查詢的信息,則在界面輸入信息,并調(diào)用系統(tǒng)暫停函數(shù),返回界面;若沒有找到查詢的信息,調(diào)用系統(tǒng)暫停函數(shù),返回界面。刪除打開文件,從鍵盤輸入要刪除的信息,若在文件里找到要刪除的信息存在,則把文件里要刪除的那條信息刪除掉,并調(diào)用系統(tǒng)暫停函數(shù),返回界面;若沒有找到刪除的信息,調(diào)用系統(tǒng)暫停函數(shù),返回界面。修改打開文件,從鍵盤輸入要修改的信息,若在文件里找到要修改的信息存在,則按照提示信息依次輸入要修改的信息,寫入文件,并調(diào)用系統(tǒng)暫停函數(shù),返回界面;若沒有找到修改的信息,調(diào)用系統(tǒng)暫停函數(shù),返回界面。主要代碼段分析/**對系統(tǒng)進行初始化,建立用戶記錄和商品記錄**/voidInitSystem(){ FILE*fp;SystemUseradminUser,bossUser,sellUser;//管理員,店長,銷售員三個角色信息Productsproducts[2];//初始化兩件服裝商品信息SellInfoRecordsellInfo[2];//初始化兩條銷售記錄 //初始化管理員用戶名、密碼與類型strcpy(adminUser.userName,"admin");strcpy(adminUser.password,"admin");adminUser.userType=ADMIN_USER_TYPE;adminUser.next=NULL;//打開管理員用戶信息文件Admin.txt,寫入信息,并關(guān)閉文件 fp=fopen("Admin.txt","w"); fprintf(fp,"%s\t%s",adminUser.userName,adminUser.password); fclose(fp);AddUser(&adminUser);AddUser(&bossUser);AddUser(&sellUser);//添加第一條商品信息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;//添加第二條商品信息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,"測試數(shù)據(jù)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,"測試數(shù)據(jù)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]);};//添加商品信息voidInputAndAddProduct(){Productsproduct;printf("親愛的%s朋友,你好,請依次輸入新商品的信息:\n",currentUser);//輸入商品名稱、型號、制作商、價格、數(shù)量、附加信息,并把從鍵盤輸入的值賦值給結(jié)構(gòu)體變量的商品名稱型號、制作商、價格、數(shù)量、附加信息printf("商品名稱:");scanf("%s",ductName);printf("商品型號:");scanf("%s",ductType);printf("商品制造商:");scanf("%s",ductCompany);printf("商品價格:");scanf("%f",&ductPrice);printf("商品數(shù)量:");scanf("%d",&ductCount);printf("商品附加信息:");scanf("%s",product.memo);product.next=NULL;//若成功信息添加到結(jié)構(gòu)體變量product里則提示添加成功if(FUNCTION_SUCCESS==AddProduct(&product))printf("商品信息添加成功!\n"); system("pause");};//修改商品信息voidModifyProduct(){intproductId;//待修改的商品編號Products*tmpProduct; printf("親愛的%s朋友,你好,你現(xiàn)在進入的商品信息修改功能:\n",currentUser);printf("請輸入要修改的商品編號:");scanf("%d",&productId);//將從鍵盤接收到的商品編號賦值給變量productIdtmpProduct=pProductHead;if(NULL==tmpProduct)return;while(NULL!=tmpProduct){if(productId==tmpProduct->productId){//若從鍵盤輸入的商品編號與文件中的一致,則修改商品信息printf("商品編號%d的商品信息如下:\n",productId);printf("商品名稱:%s\n",tmpProduct->productName);printf("商品型號:%s\n",tmpProduct->productType);printf("商品廠家:%s\n",tmpProduct->productCompany);printf("商品價格:%f\n",tmpProduct->productPrice);printf("商品數(shù)量:%d\n",tmpProduct->productCount);printf("商品附加信息:%s\n",tmpProduct->memo);printf("下面請對照修改該商品的相應(yīng)信息:\n");printf("新的商品名稱:");scanf("%s",tmpProduct->productName);printf("新的商品型號:");scanf("%s",tmpProduct->productType);printf("新的商品廠家:");scanf("%s",tmpProduct->productCompany);printf("新的商品價格:");scanf("%f",&tmpProduct->productPrice);printf("新的商品數(shù)量:");scanf("%d",&tmpProduct->productCount);printf("新的商品附加信息:");scanf("%s",tmpProduct->memo);printf("商品信息修改成功!\n"); system("pause");break;}tmpProduct=tmpProduct->next;}};//商品刪除voidDeleteProduct(){intproductId=0;Products*tmpProductA,*tmpProductB; printf("親愛的%s朋友,你好,你現(xiàn)在進入的商品刪除功能:\n",currentUser);printf("請輸入你要刪除的商品編號:");scanf("%d",&productId);tmpProductA=tmpProductB=pProductHead;//tmpProductB指向要刪除的記錄,tmpProductA指向前一條記錄if(NULL==tmpProductB)return;while(NULL!=tmpProductB){if(tmpProductB->productId==productId){if(tmpProductB==pProductHead&&tmpProductB->next==NULL){//如果系統(tǒng)只有一條商品信息free(pProductHead);pProductHead=NULL;printf("商品信息刪除成功!\n"); system("pause");return;}tmpProductA->next=tmpProductB->next;if(pProductHead==tmpProductB)pProductHead=tmpProductB->next;free(tmpProductB);printf("商品信息刪除成功!\n"); system("pause");return;}else{tmpProductA=tmpProductB;tmpProductB=tmpProductB->next;}}printf("對不起,不存在該商品編號的信息!");};//商品查詢voidProductFind(){Products*tmpProduct;intfindWay,productId;charproductName[20]; printf("親愛的%s朋友,你好,你現(xiàn)在進入的商品查詢功能:\n",currentUser);printf("請選擇查詢方式:1--按商品編號查詢2--按商品名稱查詢:");scanf("%d",&findWay);tmpProduct=pProductHead;switch(findWay){case1:printf("請輸入查詢的商品編號:");scanf("%d",&productId);//輸入要查詢的商品編號while(NULL!=tmpProduct){if(productId==tmpProduct->productId){//若輸入查詢的商品編號與文件中的一致,則輸出商品信息printf("你查詢的商品編號為%d的商品信息如下:\n",productId);printf("商品名稱:%s\n",tmpProduct->productName);printf("商品型號:%s\n",tmpProduct->productType);printf("商品廠家:%s\n",tmpProduct->productCompany);printf("商品價格:%f\n",tmpProduct->productPrice);printf("商品數(shù)量:%d\n",tmpProduct->productCount);printf("商品附加信息:%s\n",tmpProduct->memo); system("pause");return;}tmpProduct=tmpProduct->next;}printf("對不起,不存在該商品編號的商品!\n"); system("pause");case2:printf("請輸入查詢的商品名稱:");scanf("%s",productName);//輸入要查詢的商品名稱while(NULL!=tmpProduct){if(0==strcmp(tmpProduct->productName,productName)){//若輸入查詢的商品名稱與文件中的一致,則輸出商品信息printf("你要查詢的商品名稱為%s的商品信息如下:\n",productName);printf("商品名稱:%s\n",tmpProduct->productName);printf("商品型號:%s\n",tmpProduct->productType);printf("商品廠家:%s\n",tmpProduct->productCompany);printf("商品價格:%f\n",tmpProduct->productPrice);printf("商品數(shù)量:%d\n",tmpProduct->productCount);printf("商品附加信息:%s\n",tmpProduct->memo); system("pause");return;}tmpProduct=tmpProduct->next;}printf("對不起,不存在該商品編號的商品!\n"); system("pause");default:break;}}四、調(diào)試過程(1.測試數(shù)據(jù)設(shè)計2.測試結(jié)果分析)初始化用戶名與密碼管理員:adminadmin店長:bossboss銷售員:sellsell(一)主界面(二)以管理員方式登陸系統(tǒng),輸入正確的用戶賬號admin和密碼admin若登陸名或密碼錯誤,則提示用戶不存在登陸成功,進入管理員界面選擇“(1)自身密碼修改”,修改管理員密碼選擇“(2)用戶信息管理”,進行用戶的增、刪、改、查功能選擇“用戶信息查看”,查看當前用戶信息選擇“用戶信息添加”,添加用戶信息選擇“用戶信息刪除”,刪除用戶返回管理員界面,選擇“(3)商品信息管理”,進行商品的增、刪、改、查功能。選擇“用戶信息查看”,查看當前商品信息。選擇“商品信息查找”,根據(jù)商品編號及商品名稱進行查找。首先,選擇“按商品編號查詢”,若查詢的編號存在,則顯示查詢的信息若查詢的商品編號不存在,則提示信息“對不起,不存在該商品編號的商品”選擇“按商品名稱查詢”,輸入正確的商品名稱,顯示查詢信息若查詢的商品名稱不存在,則提示信息“對不起,不存在該商品編號的商品”選擇“商品信息添加”,添加商品信息選擇“商品信息修改”,修改商品信息選擇“商品信息刪除”,刪除商品返回管理員界面,選擇“商品報表顯示”,進行銷售報表功能選擇“所有商品銷售情況”,顯示商品信息選擇“商品日銷售報表”,查看符合條件的銷售商品若查詢的信息不符合條件,則顯示沒有符合條件的記錄選擇“商品月銷售報表”,查看符合條件的銷售商品選擇“銷售員銷售報表”,查看符合條件的銷售商品(三)以店長方式登錄系統(tǒng)選擇“自身密碼修改”,修改店長密碼店長其他功能(商品信息管理,銷售報表顯示)與管理員類似。(四)以銷售員登陸系統(tǒng)選擇“商品銷售”功能,進行產(chǎn)品銷售若銷售產(chǎn)品大于庫存,則提示銷售失敗。銷售員商品瀏覽、查詢、及報表查看功能與管理員功能類似五、總結(jié)1.設(shè)計中遇到的問題及解決過程2.設(shè)計中產(chǎn)生的錯誤及原因分析3.設(shè)計體會和收獲。六、附錄1、原代碼#include<stdio.h>//標準輸入輸出函數(shù)#include<windows.h>//Windows頭文件#include<time.h>//日期和時間頭文件#defineADMIN_USER_TYPE1#defineBOSS_USER_TYPE2#defineSELL_USER_TYPE3#defineFUNCTION_FAILED-1#defineFUNCTION_SUCCESS0//如果函數(shù)成功執(zhí)行,將返回0/**系統(tǒng)用戶結(jié)構(gòu)**/typedefstructSystemUser{charuserName[20];//用戶名,主鍵charpassword[20];//用戶密碼intuserType;//用戶類型(1:管理員;2:店長;3:銷售員)structSystemUser*next;//指向下一個用戶的指針}SystemUser;/**服裝商品信息**/typedefstructProducts{intproductId;//商品編號,主鍵charproductName[20];//商品名稱charproductType[20];//商品型號charproductCompany[20];//商品廠家floatproductPrice;//商品價格intproductCount;//商品數(shù)量charmemo[50];//商品附加信息structProducts*next;//指向下一個商品的指針}Products;/**銷售記錄信息結(jié)構(gòu)**/typedefstructSellInfoRecord{intsaleId;//銷售編號,主鍵charuserName[20];//銷售商品的用戶名intproductId;//銷售的商品編號intsellCount;//銷售數(shù)量intyear;//銷售商品年份intmonth;//銷售商品月份intday;//銷售商品日期charmemo[50];//銷售的附加信息structSellInfoRecord*next;//下一條銷售記錄}SellInfoRecord;staticcharcurrentUser[20];//系統(tǒng)全局變量,保存當前登陸用戶名;staticintcurrentUserType;//系統(tǒng)全局變量,保存當前登陸用戶的用戶類型staticSystemUser*pSystemUserHead=NULL;//保存系統(tǒng)用戶信息記錄的頭指針staticProducts*pProductHead=NULL;//保存系統(tǒng)商品信息記錄的頭指針staticSellInfoRecord*pSellInfoHead=NULL;//保存系統(tǒng)銷售記錄的頭指針voidInitSystem();//對系統(tǒng)用戶信息和商品信息進行初始化intAddUser(SystemUser*);//向用戶信息鏈表中加入用戶信息intAddProduct(Products*pPro);//向商品信息鏈表中加入商品信息intAddSellInfo(SellInfoRecord*);voidUserExit();voidWelcomeMenu();//系統(tǒng)歡迎菜單voidSystemLogin();//系統(tǒng)登陸voidAdminOperationMenu();//系統(tǒng)管理員操作菜單voidBossOperationMenu();//店長操作菜單voidSellOperationMenu();//銷售員操作菜單voidChangePassword();//修改密碼voidUserManage();//用戶信息管理voidUserInfoView();//用戶信息查看voidUserInfoAdd();//用戶信息添加voidUserInfoModify();//用戶信息修改voidUserInfoDelete();//用戶信息刪除voidProductsManage();//產(chǎn)品信息管理voidProductsView();//商品查看voidProductFind();voidInputAndAddProduct();//輸入商品信息并添加voidModifyProduct();//修改商品信息voidDeleteProduct();//刪除商品信息voidProductsSell();//商品銷售voidReportPrint();//報表顯示voidShowAllSellReport();//顯示所有商品銷售情況voidShowDaySellReport();//顯示某日的銷售情況voidShowMonthSellReport();//顯示某月的銷售情況voidShowEmployeeSellReport();//顯示某個銷售員的銷售情況voidExitSystem();//退出登陸系統(tǒng)floatgetPriceById(int);//通過商品編號查詢商品價格intgetProductNameById(int,char*);//通過商品編號查詢商品名稱intgetCountById(int);//通過商品編號查詢商品庫存數(shù)量voidReduceProductCount(int,int);//通過商品編號減少商品數(shù)量/**對系統(tǒng)進行初始化,建立用戶記錄和商品記錄**/voidInitSystem(){ FILE*fp;SystemUseradminUser,bossUser,sellUser;//管理員,店長,銷售員三個角色信息Productsproducts[2];//初始化兩件服裝商品信息SellInfoRecordsellInfo[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,"測試數(shù)據(jù)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,"測試數(shù)據(jù)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]);};/**函數(shù)功能:向系統(tǒng)用戶信息鏈表中加入用戶信息**/intAddUser(SystemUser*pUser){SystemUser*pSystemUser,*tempSystemUser;tempSystemUser=pSystemUserHead;while(NULL!=tempSystemUser){if(0==strcmp(tempSystemUser->userName,pUser->userName)){printf("對不起,你要添加的用戶已經(jīng)存在");returnFUNCTION_FAILED;}tempSystemUser=tempSystemUser->next;}pSystemUser=(SystemUser*)malloc(sizeof(SystemUser));//在堆空間中分配用戶信息的內(nèi)存if(NULL==pSystemUser){printf("分配用戶信息內(nèi)存時發(fā)生錯誤");returnFUNCTION_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;//將用戶信息加入到鏈表的最后}returnFUNCTION_SUCCESS;};/**函數(shù)功能:向商品信息鏈表中加入商品信息**/intAddProduct(Products*pPro){intnewProductId=1;//新加入商品的商品編號從1開始Products*tempProduct,*pProduct;tempProduct=pProductHead;//生成編號,最后一件商品編號+1while(NULL!=tempProduct){newProductId=tempProduct->productId+1;tempProduct=tempProduct->next;}pProduct=(Products*)malloc(sizeof(Products));if(NULL==pProduct){printf("對不器,添加商品信息時,堆內(nèi)存分配失敗!");returnFUNCTION_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;}returnFUNCTION_SUCCESS;};/**函數(shù)功能:向系統(tǒng)銷售信息鏈表中加入銷售信息**/intAddSellInfo(SellInfoRecord*pSellInfo){intnewSellInfoId=1;//新加入銷售記錄的編號從1開始SellInfoRecord*tmpSellInfo,*pSellInfoRecord;tmpSellInfo=pSellInfoHead;//生成編號,最后一個銷售編號+1while(NULL!=tmpSellInfo){newSellInfoId=tmpSellInfo->saleId+1;tmpSellInfo=tmpSellInfo->next;}pSellInfoRecord=(SellInfoRecord*)malloc(sizeof(SellInfoRecord));if(NULL==pSellInfoRecord){printf("對不起,添加銷售記錄信息時,堆內(nèi)存分配失敗!");returnFUNCTION_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;}returnFUNCTION_SUCCESS;};/*系統(tǒng)登陸函數(shù)*/voidSystemLogin(){charuserName[20],password[20];intisLogin=0;SystemUser*tmpUser;printf("請輸入你的系統(tǒng)用戶帳號:");scanf("%s",userName);printf("請輸入你的系統(tǒng)用戶密碼:");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){caseADMIN_USER_TYPE:AdminOperationMenu();break;caseBOSS_USER_TYPE:BossOperationMenu();break;caseSELL_USER_TYPE:SellOperationMenu();break;default:break;}}else{printf("對不起,你輸入的密碼錯誤!\n");SystemLogin();//用戶名正確,密碼錯誤}}tmpUser=tmpUser->next;}if(isLogin!=1){printf("對不起,該用戶不存在\n");//遍歷了所有用戶都沒有找到用戶SystemLogin();}}//歡迎界面voidWelcomeMenu(){printf("********************歡迎光臨服裝銷售管理系統(tǒng)********************\n");printf("系統(tǒng)功能說明:\n");printf("管理員功能:\n");printf("(1)自身密碼修改\n");printf("(2)用戶信息管理:添加,修改,刪除,查詢\n");printf("(3)商品信息管理:添加,修改,查詢,刪除\n");printf("(4)銷售報表顯示:日銷售報表,月銷售報表,銷售員銷售報表\n");printf("(5)返回主界面\n"); printf("(6)退出系統(tǒng)\n");printf("店長功能:\n");printf("(1)自身密碼修改\n");printf("(2)商品信息管理:添加,修改,查詢,刪除\n"); printf("(3)銷售報表顯示:日銷售報表,月銷售報表,銷售員銷售報\n");printf("(4)返回主界面\n"); printf("(5)退出系統(tǒng)\n");printf("銷售員功能:\n");printf("(1)商品瀏覽,查詢,商品銷售\n");printf("(2)自己商品銷售報表顯示:日銷售報表,月銷售報表\n");printf("(3)返回主界面\n"); printf("(4)退出系統(tǒng)\n");printf("*************************歡迎使用本系統(tǒng)**************************\n");};//管理員界面voidAdminOperationMenu(){intselect;while(1){ system("cls");printf("親愛的管理員%s同志,歡迎使用本系統(tǒng),你擁有下面所有功能:\n",currentUser);printf("(1)自身密碼修改\n");printf("(2)用戶信息管理:添加,修改,查詢,刪除\n");printf("(3)商品信息管理:添加,修改,查詢,刪除\n");printf("(4)銷售報表顯示:日報表,月報表,商品銷售量報表,銷售員業(yè)績報表\n"); printf("(5)返回主界面\n");printf("(6)退出系統(tǒng)\n");printf("請輸入上面功能對應(yīng)的序號進行功能選擇:");scanf("%d",&select);switch(select){case1:ChangePassword();continue;case2:UserManage();continue;case3:ProductsManage();continue;case4:ReportPrint();continue; case5:UserExit();break; case6:ExitSystem();break;default:break;} if(select==5)break;}};//店長界面voidBossOperationMenu(){intselect;while(1){ system("cls");printf("親愛的店長%s同志,歡迎使用本系統(tǒng),你擁有下面所有功能:\n",currentUser);printf("(1)自身密碼修改\n");printf("(2)商品信息管理:添加,修改,查詢,刪除\n");printf("(3)銷售報表顯示:日報表,月報表,商品銷售量報表,銷售員業(yè)績報表\n");printf("(4)返回主界面\n"); printf("(5)退出系統(tǒng)\n");printf("請輸入上面功能對應(yīng)的序號進行功能選擇:");scanf("%d",&select);switch(select){case1:ChangePassword();continue;case2:ProductsManage();continue;case3:ReportPrint();continue;case4:UserExit();break; case5:ExitSystem();break;default:break;} if(select==4)break;}};//銷售員界面voidSellOperationMenu(){intselect;while(1){ system("cls");printf("親愛的銷售員%s同志,歡迎使用本系統(tǒng),你擁有下面所有功能:\n",currentUser);printf("(1)商品瀏覽\n");printf("(2)商品查詢\n");printf("(3)商品銷售\n");printf("(4)報表查看\n");printf("(5)返回主界面\n"); printf("(6)退出系統(tǒng)\n");printf("請輸入上面功能對應(yīng)的序號進行功能選擇:");scanf("%d",&select);switch(select){case1:ProductsView();continue;case2:ProductFind();continue;case3:ProductsSell();continue;case4:ReportPrint();continue;case5:UserExit();break; case6:ExitSystem();break;default:break;} if(select==5)break;}};//更改密碼voidChangePassword(){charnewPassword1[20],newPassword2[20];SystemUser*tmpUser; printf("*********************************************************\n");printf("請輸入你的新密碼:");scanf("%s",newPassword1);printf("請再次輸入你的新密碼:");scanf("%s",newPassword2);if(0!=strcmp(newPassword1,newPassword2)){printf("對不起,你兩次輸入的密碼不一致,修改失敗!\n");return;}tmpUser=pSystemUserHead;while(NULL!=tmpUser){if(0==strcmp(tmpUser->userName,currentUser)){strcpy(tmpUser->password,newPassword1);printf("密碼修改成功!\n"); system("pause");break;}tmpUser=tmpUser->next;}};//用戶信息管理功能voidUserManage(){intselect;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)退出登陸系統(tǒng)\n");printf("請輸入上面功能對應(yīng)的序號進行功能選擇:");scanf("%d",&select);switch(select){case1:UserInfoView();continue;case2:UserInfoAdd();continue;case3:UserInfoModify();continue;case4:UserInfoDelete();continue;case5:AdminOperationMenu();break;case6:ExitSystem();break;default:break;}}};//商品信息查看voidProductsView(){Products*tmpProduct;inti;i=1;tmpProduct=pProductHead;if(NULL==tmpProduct)printf("對不起,目前還沒有商品信息");else{while(NULL!=tmpProduct){ printf("*********************************************************\n");printf("第%d件商品信息如下:\n",i);printf("商品編號:%d\n",tmpProduct->productId);printf("商品名稱:%s\n",tmpProduct->productName);printf("商品型號:%s\n",tmpProduct->productType);printf("商品廠家:%s\n",tmpProduct->productCompany);printf("商品價格:%f\n",tmpProduct->productPrice);printf("商品數(shù)量:%d\n",tmpProduct->productCount);printf("商品附加信息:%s\n",tmpProduct->memo);tmpProduct=tmpProduct->next;i++;} system("pause");}};//產(chǎn)品銷售功能voidProductsSell(){SellInfoRecordsellInfo; printf("*********************************************************\n");printf("親愛的銷售員朋友%s,你好,你現(xiàn)在進入的是產(chǎn)品的銷售功能:\n",currentUser);printf("請依次輸入以下銷售信息:\n");printf("銷售的產(chǎn)品編號:");scanf("%d",&sellIductId);printf("銷售的產(chǎn)品數(shù)量:");scanf("%d",&sellInfo.sellCount);if(sellInfo.sellCount>getCountById(sellIductId)){printf("對不起,你輸入的銷售數(shù)量大于庫存,銷售失敗!\n");system("pause"); return; }strcpy(sellInfo.userName,currentUser);printf("銷售商品所在年份:");scanf("%d",&sellInfo.year);printf("銷售商所在月份:");scanf("%d",&sellInfo.month);printf("銷售商品所在號數(shù):");scanf("%d",&sellInfo.day);prin
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 二零二五年度宅基地房屋贈與受贈方后續(xù)使用協(xié)議
- 2025年度海景房房屋買賣協(xié)議書
- 二零二五年度學(xué)校食堂炊事員崗位聘用及食品安全責任保險服務(wù)合同
- 2025年度能源行業(yè)人員派遣勞務(wù)合同
- 二零二五年度文化活動免責的舉辦協(xié)議
- 二零二五年度餐廳租賃服務(wù)及品牌合作協(xié)議
- 二零二五年度企業(yè)資產(chǎn)質(zhì)押貸款合同
- 臨時工用工合同-2025年度制造業(yè)合作協(xié)議
- 2025年度旅游意外傷害保險責任免除合同
- 二零二五年度勞動合同解除協(xié)議書-員工合同續(xù)簽協(xié)商解除
- 《電工電子技術(shù)基礎(chǔ)》高職全套教學(xué)課件
- (正式版)JB∕T 14732-2024 中碳和中碳合金鋼滾珠絲杠熱處理技術(shù)要求
- 四川省既有居住小區(qū)改造技術(shù)標準
- 慢性血栓栓塞性肺動脈高壓診斷與治療指南(2024版)解讀
- 2024年南京科技職業(yè)學(xué)院單招職業(yè)適應(yīng)性測試題庫完整
- 中國慢性便秘診治指南課件
- 2024年同等學(xué)力申碩-同等學(xué)力(經(jīng)濟學(xué))筆試考試歷年真題含答案
- 小學(xué)生國家文化安全教育
- 2024年常州工業(yè)職業(yè)技術(shù)學(xué)院單招職業(yè)技能測試題庫及答案解析
- AQ-T 3002-2021阻隔防爆橇裝式加油(氣)裝置技術(shù)要求
- (正式版)QBT 8022-2024 冷凍飲品 食用冰
評論
0/150
提交評論