当前位置:网站首页>大一学生课设c——服装管理系统

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

2022-06-23 03:48:00 InfoQ

前言

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

服装管理系统

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

#include <stdio.h>
#include <malloc.h>
#include <string.h>
#include <stdlib.h>
#include <conio.h>

//说明:这个程序中的管理员,店长,销售员密码都是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(&quot;cls&quot;);
 printf(&quot; /======================服装销售系统系统商品添加=======================/\n&quot;);

 printf(&quot; 请输入商品的名称:&quot;);
 scanf(&quot;%s&quot;,&name);
 printf(&quot;\n 请输入入库的商品的数量:&quot;) ;
 scanf(&quot;%d&quot;,&total);
 
 printf(&quot;\n\n\n 商品信息输入完毕!\n\n\n&quot;);
 
 
 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(&quot;pause&quot;);
 return 1;
 }
 
 }
 
 return 0;


int deldress(DRESS *dress)//删除
{
 


int finddress(DRESS *dress)//查找
{
 



void dressall(DRESS *dress)
{
 int i;
 system(&quot;cls&quot;);

 printf(&quot; /======================服装销售系统系统查看商品=======================/\n&quot;);

 
 for(i=0;i<500;i++)
 {
 if(dress[i].flag==1)
 printf(&quot; 商品的名称为: %s ,商品的总量为: %d ,商品的现存量 %d \n&quot;,dress[i].name,dress[i].total,dress[i].now);
 }
 system(&quot;pause&quot;);
}


void adminIntiate(ADMIN *adm) //管理员密码用户名初始化 
{
 strcpy(adm->name,&quot;admin&quot;);
 strcpy(adm->pass,&quot;123456&quot;);
}
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(&quot;cls&quot;);

 printf(&quot; /======================服装销售系统系统用户注册=======================/\n&quot;);

 

 
 
 }

int deluser(USER *use)
{
 int i;
 char name[20];

 printf(&quot; /======================服装销售系统用户删除============================/\n&quot;);

 
 
 return 0;
}
int useall(USER *use)
{
 int i;
 system(&quot;cls&quot;);

 printf(&quot; /======================服装销售系统用户查看=========================/\n&quot;);

 return 0;
}
int adminload(ADMIN *adm)
{
 char name[21];
 char pass[7]={0};
 int chose,chose2;
 
 int i;
 while(1)
 {
 system(&quot;cls&quot;);
 printf(&quot; /======================服装销售系统管理员登陆========================/\n&quot;);

 printf(&quot; 管理员账号:&quot;);
 scanf(&quot;%s&quot;,&name);
 printf(&quot; 密 码:&quot;);
 
 for(i=0;i<6;i++)
 {
 pass[i]=getch();
 printf(&quot;*&quot;);
 }

 while(1)
 {
 printf(&quot;\n\n 用户登陆信息输入完毕,是否确认? 1,确认 0,重新输入\n&quot;); 
 scanf(&quot;%d&quot;,&chose);
 if(chose!=1&&chose!=0)
 {
 printf(&quot; 你的输入有误,请重新的输入!\n&quot;);
 continue;
 }
 if(chose==1)
 {
 if(strcmp(adm->name,name)==0)
 if(strcmp(adm->pass,pass)==0)
 {
 printf(&quot; 登陆成功!请继续使用! \n&quot;);
 strcpy(usertemp.username,name);
 return 1;
 }
 
 printf(&quot; 输入的用户名或者密码有误!1,重新登陆 2,退出登陆!\n&quot;);
 scanf(&quot;%d&quot;,&chose2);
 if(chose2==1)
 {
 system(&quot;cls&quot;);
 break;
 }
 else 
 {
 system(&quot;cls&quot;);
 return 0;
 }
 } 
 if(chose==0) break;
 }
 
 } 
}
int adminpass(ADMIN *adm)
{
 int i;
 char pass[20]={0};
 char pass2[20]={0};
 
 while(1)
 {
 system(&quot;cls&quot;);
 
 printf(&quot; /======================服装销售系统管理员密码修改===================/\n&quot;);
 printf(&quot; 请输入新的管理员密码:&quot;);
 
 for(i=0;i<6;i++)
 {
 pass[i]=getch();
 printf(&quot;*&quot;);
 }
 
 
 printf(&quot;\n\n\n 请再次输入新的管理员密码:&quot;);
 for(i=0;i<6;i++)
 {
 pass2[i]=getch();
 printf(&quot;*&quot;);
 } 
 
 if(strcmp(pass,pass2)!=0)
 {
 printf(&quot;\n\n 两次输入的新的密码不一样,请重新的输入!\n\n\n&quot;);
 system(&quot;pause&quot;);
 }
 else
 {
 printf(&quot;\n 密码修改成功!下一次管理员登陆请使用新的密码!\n\n\n&quot;);
 strcpy(adm->pass,pass);
 system(&quot;pause&quot;);
 return 1;
 }
 } 
}
int adminout()
{
 int chose;
 
 while(1)
 {
 system(&quot;cls&quot;);
 
 printf(&quot; /======================服装销售系统管理员注销=====================/\n&quot;);
 
 printf(&quot; 你确定要注销吗? 1,注销 0,取消\n\n&quot;);
 scanf(&quot;%d&quot;,&chose);
 
 if(chose!=0&&chose!=1)
 {
 printf(&quot; 你的选项出现了错误,请重新的输入!\n\n\n&quot;);
 system(&quot;pause&quot;);
 continue;
 }
 if(chose==1)
 {
 printf(&quot; 管理员账户注销完毕!! \n\n\n\n&quot;); 
 system(&quot;pause&quot;); 
 return 1;
 }
 else return 0;

 }
 
}

int out()
{
 int chose;
 
 system(&quot;cls&quot;);
 printf(&quot; /==========================服装管理系统首界面======================/\n&quot;);
 
 

int adminmenu(ADMIN *adm,USER *use,DRESS *dress)
{
 int chose1;
 while(1)
 {
 system(&quot;cls&quot;);
 printf(&quot; /======================服装销售系统管理员菜单========================/\n&quot;);
 
 printf(&quot;\n 在线用户: %s\n\n&quot;,usertemp.username);
 printf(&quot; //=======用户功能菜单=====//\n&quot;);
 printf(&quot; // //\n&quot;);
 printf(&quot; // 1,添加用户 //\n&quot;);
 printf(&quot; // 2,删除用户 //\n&quot;);
 printf(&quot; // 3,统计用户 //\n&quot;);
 printf(&quot; // 4,添加商品 //\n&quot;);
 printf(&quot; // 5,删除商品 //\n&quot;);
 printf(&quot; // 6,查找商品 //\n&quot;);
 printf(&quot; // 7,商品统计 //\n&quot;);
 printf(&quot; // 8,修改密码 //\n&quot;);
 printf(&quot; // 9,注销账户 //\n&quot;);
 printf(&quot; // 0,退出系统 //\n&quot;);
 printf(&quot; //=========================//\n&quot;);
 printf(&quot;\n /=============================请选择服务的种类========================/\n&quot;);

 scanf(&quot;%d&quot;,&chose1);
 if(chose1<0||chose1>9)
 {
 printf(&quot; 你的输入有误,请重新的输入!\n&quot;);
 system(&quot;pause&quot;); 
 continue;
 }
 
 switch(chose1)
 {
 case 1:
 {
 system(&quot;cls&quot;);
 regnew(use);
 system(&quot;pause&quot;);
 break;
 }
 case 2:
 {
 system(&quot;cls&quot;);
 deluser(use);
 system(&quot;pause&quot;);
 break;
 }
 case 3:
 {
 system(&quot;cls&quot;);
 useall(use);
 system(&quot;pause&quot;);
 break;
 }
 case 4:
 {
 system(&quot;cls&quot;);
 adddress(dress);
 system(&quot;pause&quot;); 
 break;
 }
 case 5:
 {
 system(&quot;cls&quot;);
 deldress(dress); 
 break;
 }
 case 6:
 {
 system(&quot;cls&quot;);
 finddress(dress); 
 break;
 }

 case 7:
 {
 system(&quot;cls&quot;);
 dressall(dress);
 system(&quot;pause&quot;); 
 break;
 }
 case 8:
 {
 system(&quot;cls&quot;);
 if(adminpass(adm)==1) continue; 
 break;
 }
 case 9:
 {
 system(&quot;cls&quot;);
 if(adminout()==1) return 3; 
 
 }

 case 0:
 {
 system(&quot;cls&quot;);
 if(out()==1) continue; 
 break;
 }
 default: continue; 
 
 }
 
 } //while函数循环结束 
}


int userload(USER *use)
{

 printf(&quot; /======================服装管理系统销售人员登陆=======================/\n&quot;);

 

int userout()
{
 int chose;
 
 
 system(&quot;cls&quot;);
 printf(&quot; /======================服装销售系统销售员注销=====================/\n&quot;);
 
 
}
int sold(USER *use,DRESS *dress)
{
 char name[20];
 int num;
 int i;
 int j;
 int k;
 system(&quot;cls&quot;);
 printf(&quot; /======================服装销售系统销售人员菜单======================/\n&quot;);
 
 
 return 0;
}
void mounth(USER *use)
{
 
 int i;
 int j;
 char name[20];
 strcpy(name,usertemp.username);
 
 
 system(&quot;cls&quot;);
 printf(&quot; /======================服装销售系统销售人员销售记录====================/\n&quot;);
 
 printf(&quot;\n 在线用户: %s\n\n&quot;,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(&quot; 商品名称: %s ,出售数量 : %d\n&quot;,use[i].mdb[j].name,use[i].mdb[j].total);
 
 }
 }
 }
}

int usermenu(USER *use,DRESS *dress)
{
 //int i;
 int chose1;
 
 while(1)
 {
 system(&quot;cls&quot;);
 printf(&quot; /======================服装销售系统销售人员菜单======================/\n&quot;);
 
 printf(&quot;\n 在线用户: %s\n\n&quot;,usertemp.username);
 printf(&quot; //=======用户功能菜单=====//\n&quot;);
 printf(&quot; // //\n&quot;);
 printf(&quot; // 1,商品浏览 //\n&quot;);
 printf(&quot; // 2,商品查找 //\n&quot;);
 printf(&quot; // 3,出售商品 //\n&quot;);
 printf(&quot; // 4,销售记录 //\n&quot;);
 printf(&quot; // 5,用户注销 //\n&quot;);
 printf(&quot; // //\n&quot;);
 printf(&quot; // //\n&quot;);
 printf(&quot; //=========================//\n&quot;);
 printf(&quot;\n /=============================请选择服务的种类========================/\n&quot;);

 scanf(&quot;%d&quot;,&chose1);
 if(chose1<0||chose1>9)
 {
 printf(&quot; 你的输入有误,请重新的输入!\n&quot;);
 system(&quot;pause&quot;); 
 continue;
 }
 
 switch(chose1)
 {
 case 1:
 {
 system(&quot;cls&quot;);
 dressall(dress);
 break;
 }
 case 2:
 {
 system(&quot;cls&quot;);
 finddress(dress);
 break;
 }
 case 3:
 {
 system(&quot;cls&quot;);
 sold(use,dress);
 system(&quot;pause&quot;);
 break;
 }
 case 4:
 {
 system(&quot;cls&quot;);
 mounth(use);
 system(&quot;pause&quot;); 
 break;
 }
 case 5:
 {
 system(&quot;cls&quot;);
 if(userout()==1) return 3; 
 break;
 }

 
 default: continue; 
 
 }
 
 } 
 
}


int monpass(USER *use)
{
 int i;
 char pass[20]={0};
 char pass2[20]={0};
 
 
 system(&quot;cls&quot;);
 printf(&quot; /======================服装销售系统店长密码修改====================/\n&quot;);
 printf(&quot; 请输入新的密码:&quot;);
 
 
}

void monsee(USER *use)
{
 
 int i;
 int j;
 // char name[20];
 
 system(&quot;cls&quot;);
 printf(&quot; /======================服装销售系统全体销售记录======================/\n&quot;);
 
 
}



int monload(USER *use)
{
 char name[21];
 char pass[7]={0};
 int chose,chose2;
 
 int i;
 while(1)
 {
 system(&quot;cls&quot;);
 printf(&quot; /======================服装管理系统店长登陆============================/\n&quot;);

 
 } 


int monout()
{
 int chose;
 
 while(1)
 {
 system(&quot;cls&quot;);
 printf(&quot; /======================服装销售系统店长注销==========================/\n&quot;);
 

 }
 
}

int fix(DRESS *dress)//修改
{
 
 
}

int monmenu(USER *use,DRESS *dress)
{
 
 
 
 printf(&quot; /======================服装销售系统店长菜单============================/\n&quot;);
 

}

 

int first(USER *use,ADMIN *adm,DRESS *dress)

{
 int chose;
 int temp,temp2;

 while(1)
 {
 
 system(&quot;cls&quot;);
 printf(&quot; /==========================服装管理系统首界面======================/\n&quot;);
 
 printf(&quot; //=========功能菜单========//\n&quot;);
 printf(&quot; // //\n&quot;);
 printf(&quot; // //\n&quot;);
 printf(&quot; // 1,销售员登陆 //\n&quot;);
 printf(&quot; // 2,店长登陆 //\n&quot;);
 printf(&quot; // 3,管理员登陆 //\n&quot;);
 printf(&quot; // //\n&quot;);
 printf(&quot; //=========================//\n&quot;);
 printf(&quot;\n /=============================请选择服务的种类========================/\n&quot;);
 
 scanf(&quot;%d&quot;,&chose);
 
 if(chose<1||chose>5) 
 {
 printf(&quot; 你的选择出现错误!按任意键重新的进入选择菜单!\n&quot;);
 system(&quot;pause&quot;);
 continue;
 }
 
 
 switch(chose)
 {
 case 1:
 {
 system(&quot;cls&quot;);
 if(userload(use)==1)
 {
 usermenu(use,dress);
 }
 system(&quot;pause&quot;);

 break;
 }
 case 2:
 {
 system(&quot;cls&quot;);
 if(monload(use)==1)
 {
 monmenu(use,dress);
 }
 break;
 }
 case 3:
 {
 system(&quot;cls&quot;);
 temp=adminload(adm);
 
 if(temp==1)
 {
 system(&quot;pause&quot;);
 temp2=adminmenu(adm,use,dress);
 return 3;
 }
 system(&quot;pause&quot;);
 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语言从0——>1专栏中也会提供几个完整版的课设解答
原网站

版权声明
本文为[InfoQ]所创,转载请带上原文链接,感谢
https://xie.infoq.cn/article/2785b18c0021c72121d87e5dd