学生课设c——服装管理系统

网友投稿 661 2022-05-29

前言

前一段时间有个同学找到我,帮他完成了一个课程设计,由于他不是学计算机的么,懂得都懂,谁大一像码明这么苦逼啊!天天捣鼓这些,所以他给了我一定的报酬,我也就帮他完成了,过去1个多月了,也不会出现雷同课设,所以我想着现在把几个主要的思路来做一下复盘。

服装管理系统

其实看来看去,还是和我们最初的图书管理系统有点像,我也就按照那个去做了,下面我来看主要的函数。

#include #include #include #include #include //说明:这个程序中的管理员,店长,销售员密码都是6位的。 // 管理员默认用户名是admin,密码是123456。 typedef struct admin //定义管理员结构体 { char name[20]; char pass[20]; }ADMIN; typedef struct // 定义商品结构体 { char name[30]; int now; int total; int flag; }DRESS; typedef struct //定义用户结构体 { int flag; int type; char username[20]; char pass[20]; DRESS mdb[100]; }USER; USER usertemp; int usernum=0; //记录销售员的数量 int adddress(DRESS *dress) { char name[20]; int total; int i; system("cls"); printf(" /======================服装销售系统系统商品添加=======================/\n"); printf(" 请输入商品的名称:"); scanf("%s",&name); printf("\n 请输入入库的商品的数量:") ; scanf("%d",&total); printf("\n\n\n 商品信息输入完毕!\n\n\n"); for(i=0;i<500;i++) { if(dress[i].flag==0) { strcpy(dress[i].name,name); dress[i].total=total; dress[i].now=total; dress[i].flag=1; system("pause"); return 1; } } return 0; } int deldress(DRESS *dress)//删除 { } int finddress(DRESS *dress)//查找 { } void dressall(DRESS *dress) { int i; system("cls"); printf(" /======================服装销售系统系统查看商品=======================/\n"); for(i=0;i<500;i++) { if(dress[i].flag==1) printf(" 商品的名称为: %s ,商品的总量为: %d ,商品的现存量 %d \n",dress[i].name,dress[i].total,dress[i].now); } system("pause"); } void adminIntiate(ADMIN *adm) //管理员密码用户名初始化 { strcpy(adm->name,"admin"); strcpy(adm->pass,"123456"); } void userIntiate(USER *use) //销售员密码用户名初始化 { int j; for(j=0; j<200; j++) { int i; use[j].flag=0; use[j].type=-1; for(i=0;i<100;i++) { use[j].mdb[i].flag=0; } } } void dressIntiate(DRESS *dress) //商品初始化 { for(int i=0; i<500; i++) { dress[i].flag=0; } } int regnew(USER *use) { char name[21]; char pass[7]={0}; int chose; int i; int type; while(1) { system("cls"); printf(" /======================服装销售系统系统用户注册=======================/\n"); } } int deluser(USER *use) { int i; char name[20]; printf(" /======================服装销售系统用户删除============================/\n"); return 0; } int useall(USER *use) { int i; system("cls"); printf(" /======================服装销售系统用户查看=========================/\n"); return 0; } int adminload(ADMIN *adm) { char name[21]; char pass[7]={0}; int chose,chose2; int i; while(1) { system("cls"); printf(" /======================服装销售系统管理员登陆========================/\n"); printf(" 管理员账号:"); scanf("%s",&name); printf(" 密 码:"); for(i=0;i<6;i++) { pass[i]=getch(); printf("*"); } while(1) { printf("\n\n 用户登陆信息输入完毕,是否确认? 1,确认 0,重新输入\n"); scanf("%d",&chose); if(chose!=1&&chose!=0) { printf(" 你的输入有误,请重新的输入!\n"); continue; } if(chose==1) { if(strcmp(adm->name,name)==0) if(strcmp(adm->pass,pass)==0) { printf(" 登陆成功!请继续使用! \n"); strcpy(usertemp.username,name); return 1; } printf(" 输入的用户名或者密码有误!1,重新登陆 2,退出登陆!\n"); scanf("%d",&chose2); if(chose2==1) { system("cls"); break; } else { system("cls"); return 0; } } if(chose==0) break; } } } int adminpass(ADMIN *adm) { int i; char pass[20]={0}; char pass2[20]={0}; while(1) { system("cls"); printf(" /======================服装销售系统管理员密码修改===================/\n"); printf(" 请输入新的管理员密码:"); for(i=0;i<6;i++) { pass[i]=getch(); printf("*"); } printf("\n\n\n 请再次输入新的管理员密码:"); for(i=0;i<6;i++) { pass2[i]=getch(); printf("*"); } if(strcmp(pass,pass2)!=0) { printf("\n\n 两次输入的新的密码不一样,请重新的输入!\n\n\n"); system("pause"); } else { printf("\n 密码修改成功!下一次管理员登陆请使用新的密码!\n\n\n"); strcpy(adm->pass,pass); system("pause"); return 1; } } } int adminout() { int chose; while(1) { system("cls"); printf(" /======================服装销售系统管理员注销=====================/\n"); printf(" 你确定要注销吗? 1,注销 0,取消\n\n"); scanf("%d",&chose); if(chose!=0&&chose!=1) { printf(" 你的选项出现了错误,请重新的输入!\n\n\n"); system("pause"); continue; } if(chose==1) { printf(" 管理员账户注销完毕!! \n\n\n\n"); system("pause"); return 1; } else return 0; } } int out() { int chose; system("cls"); printf(" /==========================服装管理系统首界面======================/\n"); } int adminmenu(ADMIN *adm,USER *use,DRESS *dress) { int chose1; while(1) { system("cls"); printf(" /======================服装销售系统管理员菜单========================/\n"); printf("\n 在线用户: %s\n\n",usertemp.username); printf(" //=======用户功能菜单=====//\n"); printf(" // //\n"); printf(" // 1,添加用户 //\n"); printf(" // 2,删除用户 //\n"); printf(" // 3,统计用户 //\n"); printf(" // 4,添加商品 //\n"); printf(" // 5,删除商品 //\n"); printf(" // 6,查找商品 //\n"); printf(" // 7,商品统计 //\n"); printf(" // 8,修改密码 //\n"); printf(" // 9,注销账户 //\n"); printf(" // 0,退出系统 //\n"); printf(" //=========================//\n"); printf("\n /=============================请选择服务的种类========================/\n"); scanf("%d",&chose1); if(chose1<0||chose1>9) { printf(" 你的输入有误,请重新的输入!\n"); system("pause"); continue; } switch(chose1) { case 1: { system("cls"); regnew(use); system("pause"); break; } case 2: { system("cls"); deluser(use); system("pause"); break; } case 3: { system("cls"); useall(use); system("pause"); break; } case 4: { system("cls"); adddress(dress); system("pause"); break; } case 5: { system("cls"); deldress(dress); break; } case 6: { system("cls"); finddress(dress); break; } case 7: { system("cls"); dressall(dress); system("pause"); break; } case 8: { system("cls"); if(adminpass(adm)==1) continue; break; } case 9: { system("cls"); if(adminout()==1) return 3; } case 0: { system("cls"); if(out()==1) continue; break; } default: continue; } } //while函数循环结束 } int userload(USER *use) { printf(" /======================服装管理系统销售人员登陆=======================/\n"); } int userout() { int chose; system("cls"); printf(" /======================服装销售系统销售员注销=====================/\n"); } int sold(USER *use,DRESS *dress) { char name[20]; int num; int i; int j; int k; system("cls"); printf(" /======================服装销售系统销售人员菜单======================/\n"); return 0; } void mounth(USER *use) { int i; int j; char name[20]; strcpy(name,usertemp.username); system("cls"); printf(" /======================服装销售系统销售人员销售记录====================/\n"); printf("\n 在线用户: %s\n\n",usertemp.username); for(i=0;i<100;i++) { if(strcmp(use[i].username,name)==0) { for(j=0;j<100;j++) { if(use[i].mdb[j].flag==1) printf(" 商品名称: %s ,出售数量 : %d\n",use[i].mdb[j].name,use[i].mdb[j].total); } } } } int usermenu(USER *use,DRESS *dress) { //int i; int chose1; while(1) { system("cls"); printf(" /======================服装销售系统销售人员菜单======================/\n"); printf("\n 在线用户: %s\n\n",usertemp.username); printf(" //=======用户功能菜单=====//\n"); printf(" // //\n"); printf(" // 1,商品浏览 //\n"); printf(" // 2,商品查找 //\n"); printf(" // 3,出售商品 //\n"); printf(" // 4,销售记录 //\n"); printf(" // 5,用户注销 //\n"); printf(" // //\n"); printf(" // //\n"); printf(" //=========================//\n"); printf("\n /=============================请选择服务的种类========================/\n"); scanf("%d",&chose1); if(chose1<0||chose1>9) { printf(" 你的输入有误,请重新的输入!\n"); system("pause"); continue; } switch(chose1) { case 1: { system("cls"); dressall(dress); break; } case 2: { system("cls"); finddress(dress); break; } case 3: { system("cls"); sold(use,dress); system("pause"); break; } case 4: { system("cls"); mounth(use); system("pause"); break; } case 5: { system("cls"); if(userout()==1) return 3; break; } default: continue; } } } int monpass(USER *use) { int i; char pass[20]={0}; char pass2[20]={0}; system("cls"); printf(" /======================服装销售系统店长密码修改====================/\n"); printf(" 请输入新的密码:"); } void monsee(USER *use) { int i; int j; // char name[20]; system("cls"); printf(" /======================服装销售系统全体销售记录======================/\n"); } int monload(USER *use) { char name[21]; char pass[7]={0}; int chose,chose2; int i; while(1) { system("cls"); printf(" /======================服装管理系统店长登陆============================/\n"); } } int monout() { int chose; while(1) { system("cls"); printf(" /======================服装销售系统店长注销==========================/\n"); } } int fix(DRESS *dress)//修改 { } int monmenu(USER *use,DRESS *dress) { printf(" /======================服装销售系统店长菜单============================/\n"); } int first(USER *use,ADMIN *adm,DRESS *dress) { int chose; int temp,temp2; while(1) { system("cls"); printf(" /==========================服装管理系统首界面======================/\n"); printf(" //=========功能菜单========//\n"); printf(" // //\n"); printf(" // //\n"); printf(" // 1,销售员登陆 //\n"); printf(" // 2,店长登陆 //\n"); printf(" // 3,管理员登陆 //\n"); printf(" // //\n"); printf(" //=========================//\n"); printf("\n /=============================请选择服务的种类========================/\n"); scanf("%d",&chose); if(chose<1||chose>5) { printf(" 你的选择出现错误!按任意键重新的进入选择菜单!\n"); system("pause"); continue; } switch(chose) { case 1: { system("cls"); if(userload(use)==1) { usermenu(use,dress); } system("pause"); break; } case 2: { system("cls"); if(monload(use)==1) { monmenu(use,dress); } break; } case 3: { system("cls"); temp=adminload(adm); if(temp==1) { system("pause"); temp2=adminmenu(adm,use,dress); return 3; } system("pause"); continue; } default: exit(0); } }//while() } int main() { USER *use; use=(USER *)malloc(200*sizeof(USER)); userIntiate(use); ADMIN *adm; adm=(ADMIN *)malloc(sizeof(ADMIN)); adminIntiate(adm); DRESS *dress; dress=(DRESS *)malloc(500*sizeof(DRESS)); dressIntiate(dress); while(1) { if(first(use,adm,dress)==3) continue; } return 0; }

学生课设c——服装管理系统

最后

由于担心部分同学直接抄作业,我还是删除了几个主要的模块的,如果有不会的课设也可以私聊我,给你提供部分解答,问题 一定是免费的!!!

我的c语言从0——>1专栏中也会提供几个完整版的课设解答

项目管理 ProjectMan

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:Java---XML的解析(2)-DOM4J解析/Xpath
下一篇:Linux应用开发:标准IO库(上)
相关文章