当前位置:网站首页>大一学生课设c——服装管理系统
大一学生课设c——服装管理系统
2022-06-23 03:48:00 【InfoQ】
前言
服装管理系统

#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("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;
}
最后
边栏推荐
猜你喜欢

Basic skills of x64dbg

Compilation, installation and global configuration section description of haproxy

Getting started with tensorflow

Pytoch --- use pytoch's pre training model to realize four weather classification problems

8 key indicators to measure technology debt in 2022

Avltree - arbre de recherche binaire équilibré

Differences between MyISAM and InnoDB of MySQL storage engine

Online text filter less than specified length tool

Halcon胶线检测—模板匹配、位姿变换、胶宽,胶连续性检测

There is a problem with redis startup
随机推荐
Bug STM32 interrupt (everyone knows)
众昂矿业:新能源新材料产业链对萤石需求大增
The tax software exits when it detects that it is a virtual machine. How to solve this problem?
Form development mode
[learn FPGA programming from scratch -40]: Advanced - Design - competition and risk
Review the SQL row column conversion, and the performance has been improved
x24Cxx系列EEPROM芯片C语言通用读写程序
PTA:7-69 数据的间距问题
最新编程语言排行榜
IDEA-导入模块
Getting started with tensorflow
Tables de recherche statiques et tables de recherche statiques
两招提升硬盘存储数据的写入效率
What is metadata
顺序表查找
Online JSON to CSharp (c) class tool
What is the difference between redistemplate and CacheManager operation redis
How the innovative use of adobe international certification 𞓜 3D changes the entire industry
Halcon glue line detection - template matching, pose transformation, glue width, glue continuity detection
Twitter与Shopify合作 将商家产品引入Twitter购物当中