服装销售管理系统C语言课程设计报告.docx

上传人:b****8 文档编号:9529828 上传时间:2023-05-19 格式:DOCX 页数:65 大小:606.27KB
下载 相关 举报
服装销售管理系统C语言课程设计报告.docx_第1页
第1页 / 共65页
服装销售管理系统C语言课程设计报告.docx_第2页
第2页 / 共65页
服装销售管理系统C语言课程设计报告.docx_第3页
第3页 / 共65页
服装销售管理系统C语言课程设计报告.docx_第4页
第4页 / 共65页
服装销售管理系统C语言课程设计报告.docx_第5页
第5页 / 共65页
服装销售管理系统C语言课程设计报告.docx_第6页
第6页 / 共65页
服装销售管理系统C语言课程设计报告.docx_第7页
第7页 / 共65页
服装销售管理系统C语言课程设计报告.docx_第8页
第8页 / 共65页
服装销售管理系统C语言课程设计报告.docx_第9页
第9页 / 共65页
服装销售管理系统C语言课程设计报告.docx_第10页
第10页 / 共65页
服装销售管理系统C语言课程设计报告.docx_第11页
第11页 / 共65页
服装销售管理系统C语言课程设计报告.docx_第12页
第12页 / 共65页
服装销售管理系统C语言课程设计报告.docx_第13页
第13页 / 共65页
服装销售管理系统C语言课程设计报告.docx_第14页
第14页 / 共65页
服装销售管理系统C语言课程设计报告.docx_第15页
第15页 / 共65页
服装销售管理系统C语言课程设计报告.docx_第16页
第16页 / 共65页
服装销售管理系统C语言课程设计报告.docx_第17页
第17页 / 共65页
服装销售管理系统C语言课程设计报告.docx_第18页
第18页 / 共65页
服装销售管理系统C语言课程设计报告.docx_第19页
第19页 / 共65页
服装销售管理系统C语言课程设计报告.docx_第20页
第20页 / 共65页
亲,该文档总共65页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

服装销售管理系统C语言课程设计报告.docx

《服装销售管理系统C语言课程设计报告.docx》由会员分享,可在线阅读,更多相关《服装销售管理系统C语言课程设计报告.docx(65页珍藏版)》请在冰点文库上搜索。

服装销售管理系统C语言课程设计报告.docx

服装销售管理系统C语言课程设计报告

C语言课程设计实验报告

一、目的(本次课程设计所涉及并要求掌握的知识点。

用户与商品信息要采用文件存储,因而要提供文件的输入输出操作;实现用户的添加、修改、删除;商品信息的添加、修改、删除、查找等功能;实现商品浏览功能的实现,需要实现显示操作;另外还要提供键盘式选择菜单以实现功能选择。

二、使用环境(本次上机实践所使用的平台和相关软件。

MicrosoftVisualC++

三、容与设计思想

(1.设计思路2.主要数据结构3.主要代码结构4.主要代码段分析。

1、设计思路

2、主要数据结构

/**系统用户结构**/

typedefstructSystemUser{

charuserName[20];//用户名,主键

charpassword[20];//用户密码

intuserType;//用户类型(1:

管理员;2:

店长;3:

销售员)

structSystemUser*next;//指向下一个用户的指针

}SystemUser;

/**服装商品信息**/

typedefstructProducts{

intproductId;//商品编号,主键

charproductName[20];//商品名称

charproductType[20];//商品型号

charproductCompany[20];//商品厂家

floatproductPrice;//商品价格

intproductCount;//商品数量

charmemo[50];//商品附加信息

structProducts*next;//指向下一个商品的指针

}Products;

/**销售记录信息结构**/

typedefstructSellInfoRecord{

intsaleId;//销售编号,主键

charuserName[20];//销售商品的用户名

intproductId;//销售的商品编号

intsellCount;//销售数量

intyear;//销售商品年份

intmonth;//销售商品月份

intday;//销售商品日期

charmemo[50];//销售的附加信息

structSellInfoRecord*next;//下一条销售记录

}SellInfoRecord;

3、主要代码结构

(一)添加

打开文件,从键盘输入要添加的信息,若添加的信息与文件里的信息重复,则调用系统暂停函数,返回界面;若添加的信息在文件里没有找到,则将添加的信息输入到文件,调用系统暂停函数,返回界面。

(2)查询

打开文件,从键盘输入要查询的信息,若在文件里找到要查询的信息,则在界面输入信息,并调用系统暂停函数,返回界面;若没有找到查询的信息,调用系统暂停函数,返回界面。

(3)删除

打开文件,从键盘输入要删除的信息,若在文件里找到要删除的信息存在,则把文件里要删除的那条信息删除掉,并调用系统暂停函数,返回界面;若没有找到删除的信息,调用系统暂停函数,返回界面。

(4)修改

打开文件,从键盘输入要修改的信息,若在文件里找到要修改的信息存在,则按照提示信息依次输入要修改的信息,写入文件,并调用系统暂停函数,返回界面;若没有找到修改的信息,调用系统暂停函数,返回界面。

4、主要代码段分析

/**对系统进行初始化,建立用户记录和商品记录**/

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,写入信息,并关闭文件

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,"测试数据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]);

};

//添加商品信息

voidInputAndAddProduct(){

Productsproduct;

printf("亲爱的%s朋友,你好,请依次输入新商品的信息:

\n",currentUser);

//输入商品名称、型号、制作商、价格、数量、附加信息,并把从键盘输入的值赋值给结构体变量的商品名称型号、制作商、价格、数量、附加信息

printf("商品名称:

");

scanf("%s",product.productName);

printf("商品型号:

");

scanf("%s",product.productType);

printf("商品制造商:

");

scanf("%s",product.productCompany);

printf("商品价格:

");

scanf("%f",&product.productPrice);

printf("商品数量:

");

scanf("%d",&product.productCount);

printf("商品附加信息:

");

scanf("%s",product.memo);

product.next=NULL;

//若成功信息添加到结构体变量product里则提示添加成功

if(FUNCTION_SUCCESS==AddProduct(&product))

printf("商品信息添加成功!

\n");

system("pause");

};

//修改商品信息

voidModifyProduct(){

intproductId;//待修改的商品编号

Products*tmpProduct;

printf("亲爱的%s朋友,你好,你现在进入的商品信息修改功能:

\n",currentUser);

printf("请输入要修改的商品编号:

");

scanf("%d",&productId);//将从键盘接收到的商品编号赋值给变量productId

tmpProduct=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("商品数量:

%d\n",tmpProduct->productCount);

printf("商品附加信息:

%s\n",tmpProduct->memo);

printf("下面请对照修改该商品的相应信息:

\n");

printf("新的商品名称:

");

scanf("%s",tmpProduct->productName);

printf("新的商品型号:

");

scanf("%s",tmpProduct->productType);

printf("新的商品厂家:

");

scanf("%s",tmpProduct->productCompany);

printf("新的商品价格:

");

scanf("%f",&tmpProduct->productPrice);

printf("新的商品数量:

");

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朋友,你好,你现在进入的商品删除功能:

\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){//如果系统只有一条商品信息

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朋友,你好,你现在进入的商品查询功能:

\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("商品数量:

%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("商品数量:

%d\n",tmpProduct->productCount);

printf("商品附加信息:

%s\n",tmpProduct->memo);

system("pause");

return;}

tmpProduct=tmpProduct->next;}

printf("对不起,不存在该商品编号的商品!

\n");

system("pause");

default:

break;}}

四、调试过程(1.测试数据设计2.测试结果分析)

初始化用户名与密码

管理员:

adminadmin店长:

bossboss销售员:

sellsell

(一)主界面

(二)以管理员式登陆系统,输入正确的用户账号admin和密码admin

若登陆名或密码错误,则提示用户不存在

登陆成功,进入管理员界面

选择“

(1)自身密码修改”,修改管理员密码

选择“

(2)用户信息管理”,进行用户的增、删、改、查功能

选择“用户信息查看”,查看当前用户信息

选择“用户信息添加”,添加用户信息

选择“用户信息删除”,删除用户

返回管理员界面,选择“(3)商品信息管理”,进行商品的增、删、改、查功能。

选择“用户信息查看”,查看当前商品信息。

选择“商品信息查找”,根据商品编号及商品名称进行查找。

首先,选择“按商品编号查询”,若查询的编号存在,则显示查询的信息

若查询的商品编号不存在,则提示信息“对不起,不存在该商品编号的商品”

选择“按商品名称查询”,输入正确的商品名称,显示查询信息

若查询的商品名称不存在,则提示信息“对不起,不存在该商品编号的商品”

选择“商品信息添加”,添加商品信息

选择“商品信息修改”,修改商品信息

选择“商品信息删除”,删除商品

返回管理员界面,选择“商品报表显示”,进行销售报表功能

选择“所有商品销售情况”,显示商品信息

选择“商品日销售报表”,查看符合条件的销售商品

若查询的信息不符合条件,则显示没有符合条件的记录

选择“商品月销售报表”,查看符合条件的销售商品

 

选择“销售员销售报表”,查看符合条件的销售商品

(三)以店长式登录系统

选择“自身密码修改”,修改店长密码

店长其他功能(商品信息管理,销售报表显示)与管理员类似。

(四)以销售员登陆系统

选择“商品销售”功能,进行产品销售

若销售产品大于库存,则提示销售失败。

销售员商品浏览、查询、及报表查看功能与管理员功能类似

五、总结

1.设计中遇到的问题及解决过程

2.设计中产生的错误及原因分析

3.设计体会和收获。

六、附录

1、原代码

#include//标准输入输出函数

#include//Windows头文件

#include//日期和时间头文件

#defineADMIN_USER_TYPE1

#defineBOSS_USER_TYPE2

#defineSELL_USER_TYPE3

#defineFUNCTION_FAILED-1

#defineFUNCTION_SUCCESS0//如果函数成功执行,将返回0

/**系统用户结构**/

typedefstructSystemUser{

charuserName[20];//用户名,主键

charpassword[20];//用户密码

intuserType;//用户类型(1:

管理员;2:

店长;3:

销售员)

structSystemUser*next;//指向下一个用户的指针

}SystemUser;

/**服装商品信息**/

typedefstructProducts{

intproductId;//商品编号,主键

charproductName[20];//商品名称

charproductType[20];//商品型号

charproductCompany[20];//商品厂家

floatproductPrice;//商品价格

intproductCount;//商品数量

charmemo[50];//商品附加信息

structProducts*next;//指向下一个商品的指针

}Products;

/**销售记录信息结构**/

typedefstructSellInfoRecord{

intsaleId;//销售编号,主键

charuserName[20];//销售商品的用户名

intproductId;//销售的商品编号

intsellCount;//销售数量

intyear;//销售商品年份

intmonth;//销售商品月份

intday;//销售商品日期

charmemo[50];//销售的附加信息

structSellInfoRecord*next;//下一条销售记录

}SellInfoRecord;

staticcharcurrentUser[20];//系统全局变量,保存当前登陆用户名;

staticintcurrentUserType;//系统全局变量,保存当前登陆用户的用户类型

staticSystemUser*pSystemUserHead=NULL;//保存系统用户信息记录的头指针

staticProducts*pProductHead=NULL;//保存系统商品信息记录的头指针

staticSellInfoRecord*pSellInfoHead=NULL;//保存系统销售记录的头指针

voidInitSystem();//对系统用户信息和商品信息进行初始化

intAddUser(SystemUser*);//向用户信息

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 党团工作 > 入党转正申请

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2