客户消费积分管理系统C++编写.doc

上传人:啊飒飒 文档编号:10129822 上传时间:2021-04-22 格式:DOC 页数:22 大小:159.50KB
返回 下载 相关 举报
客户消费积分管理系统C++编写.doc_第1页
第1页 / 共22页
客户消费积分管理系统C++编写.doc_第2页
第2页 / 共22页
客户消费积分管理系统C++编写.doc_第3页
第3页 / 共22页
客户消费积分管理系统C++编写.doc_第4页
第4页 / 共22页
客户消费积分管理系统C++编写.doc_第5页
第5页 / 共22页
点击查看更多>>
资源描述

《客户消费积分管理系统C++编写.doc》由会员分享,可在线阅读,更多相关《客户消费积分管理系统C++编写.doc(22页珍藏版)》请在三一文库上搜索。

1、面向对象技术课程设计题 目: 客户消费积分管理系统 专 业: 计算机科学与技术 学 号: 121006427 姓 名: 王文静 _ 指导老师: 宋涛 _ 完成日期: 2013/6/01 目 录1 前言22 需求分析22.1要求22.2任务22.3运行环境22.4开发工具23 概要设计与详细设计33.1系统流程图34 编码与实现34.1分析44.2具体代码实现75 课程设计总结20参考文献201 前言 设计一个程序用于管理客户的消费情况,从而根据客户的消费积分对客户实行不同程度的打折优惠。对于客户消费积分管理系统利用线性表的链表存储方式,使用结构体指针将每一个用户联系起来。程序中设计了添加用户查

2、找用户修改用户删除用户统计客户数量的功能,充分满足对于管理系统的要求。2 需求分析2.1要求(1)用C+语言实现程序设计;(2)利用线性表的链表存储方式进行相关信息处理;(3)根据系统的功能要求设计函数。(4)画出功能模块的设计图;(5)系统的各个功能模块要求用函数的形式实现;(6)良好的人机互交环境,程序要有注释。2.2任务(1)设计添加用户函数,采用结构体将每个用户的信息封装,其中包括用户姓名name、用户省份证号ID、用户消费金额consume、积分integer的信息。输入一个客户信息后再开辟新的节点连接。(2)设计各个功能函数,实现对于客户,消费金额,消费积分的管理。(3)画出功能模

3、块的设计图;(4)编写代码;(5)程序分析与调试。2.3运行环境(1)WINDOWS2000/XP/7系统(2)TurboC2.0编译环境2.4开发工具C+语言3 概要设计与详细设计3.1系统流程图如图3.1所示。客户消费积分打折操作系统 添加 显示客户信息函数统计客户数量函数删除客户函数修改客户函数查找客户函数添加客户函数修改删除统计客户数量显示客户信息查找 图3.1 系统流程图4 编码与实现4.1分析(1)添加用户。函数void Getelem (cnode *head);采用类将每个用户的信息封装,其中包括用户姓名name、用户省份证号ID、用户消费金额consume、积分integer

4、的信息。输入一个客户信息后再开辟新的节点连接。如添加一个客户:定义指针p,用于申请空的结点空间,p=(cnode*)malloc(sizeof(cnode),利用函数输入姓名,身份证号,并保证身份证号的正确。(2)void Search(cnode *head,char ID);查找用户利用指针一个一个用户比对信息知道,直到找到正确信息并显示。(3)void Amend(cnode *head,char ID);查找并显示然后修改。(4)void Delete(cnode *head,char ID);查找显示并删除。(5)void Showall(cnode *head);遍历链表并显示客户

5、。(6)void count(cnode *head);遍历统计客户数量显示(7)double display_discount(double integer);计算客户折扣,每次显示用户信息调用一次保证客户为最新打折信息。4.2具体代码实现#include iostream.h#include stdlib.h#include string.hclass C /定义一个C类public:char name20;char ID20;double consume;double integer;C *next;void Initstack(C * &head)/*初始化链表*/head= (C*)

6、malloc(sizeof(C); /开辟节点空间head-next=NULL;class A /定义一个A类,封装功能函数public:void Getelem (C *head);void Search(C *head,char ID);void Amend(C *head,char ID);void Delete(C *head,char ID);void Showall(C *head);void count(C *head);double display_discount(double integer);int main()A a; C *head; int choice;char

7、y20;Initstack(head); do coutendl; cout 客户消费 积分管理系统 endl; cout *endl; cout * *endl; cout * 主菜单 *endl; cout * 1 添加客户 *endl; cout * 2 查找客户 *endl; cout * 3 修改客户 *endl; cout * 4 删除客户 *endl; cout * 5 显示客户 *endl; cout * 6 统计客户 *endl; cout * 7 退出 *endl; cout * *endl; cout *endl; cout 请输入您的选择(1,2,3,4,5,6):ch

8、oice; if(choice=1) a.Getelem(head); /添加 else if(choice=2) couty;while(strlen(y)!=18)couty; a.Search(head,y); /查找 else if(choice=3) couty;while(strlen(y)!=18)couty; a.Amend(head,y); /修改 else if(choice=4) coutendl; couty; a.Delete(head,y); /删除 else if(choice=5) coutendl; a.Showall(head); /显示 else if(c

9、hoice=6) coutendl; a.count(head); /统计 else if(choice=7) exit(1);while(choice=7);return 0;void A:Getelem (C *head) C *p;double y;p=(C*)malloc(sizeof(C);/*申请空的节点空间*/coutp-name;coutp-ID;while(strlen(p-ID)!=18)cout p-ID;coutp-consume;p-integer=p-consume;y=display_discount(p-integer); /调用函数计算折扣cout折扣:yne

10、xt=head-next;head-next=p;void A: Search(C *head,char ID)C *p;double y;p=head;if(p-next=NULL)coutnext!=NULL)p=p-next;if(strcmp(ID,p-ID)=0) /判断身份证号是否相同 cout姓名:name;cout身份证号:ID;cout消费:consume;cout积分:integer;y=display_discount(p-integer);cout折扣:ynext=NULL)coutnext!=NULL)p=p-next;if(strcmp(ID,p-ID)=0) /判

11、断身份证号是否相同 cout姓名:name;cout身份证号:ID;cout消费:consume;cout积分:integer;y=display_discount(p-integer);cout折扣:y折;coutchoose;if(choose=1)coutp-name;if(choose=2)coutp-ID;while(strlen(p-ID)!=18)coutp-ID;if(choose=3)coutx;if(x=1)coutp-consume;elsecoutz;p-consume+=z;cout姓名:name;cout身份证号:ID;cout消费:consume;cout积分:i

12、nteger;y=display_discount(p-integer);cout折扣:ynext=NULL)coutnext!=NULL)head=p;p=p-next;if(strcmp(ID,p-ID)=0) /判断身份证号是否相同 cout姓名:name;cout身份证号:ID;cout消费:consume;cout积分:integer;y=display_discount(p-integer);cout折扣:y折;coutx;if(x=1)head-next=p-next;cout删除成功!;elsecoutnext=NULL)coutnext!=NULL)p=p-next;cout

13、姓名:name;cout身份证号:ID;cout消费:consume;cout积分:integer;y=display_discount(p-integer);cout折扣:ynext=NULL)coutnext!=NULL)p=p-next;i+; cout现有客户数量:endl;couti 0&points 50&points 100&points 150&points 200&points 300)discount = 7;return discount;5 课程设计总结通过本次课程设计更好地体会到了一个好的系统软件,在现实生活中能起到十分重要的作用。它不仅提高了工作效率,而且保证了信息保存的准确性,减轻了工作负担,使计算机技术更好的服务于社会。参考文献1 严蔚敏,吴伟民.数据结构(C语言版)清华大学出版社,1994.72 付永华,王素丽等C+高级语言程序设计中国电力出版社,2010.13 李玲玲C程序设计清华大学出版社,20116指导教师评语:成绩: 签名: 21

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

当前位置:首页 > 科普知识


经营许可证编号:宁ICP备18001539号-1