碟行客户信息管理系统Word格式.docx

上传人:b****3 文档编号:7286878 上传时间:2023-05-08 格式:DOCX 页数:19 大小:224.32KB
下载 相关 举报
碟行客户信息管理系统Word格式.docx_第1页
第1页 / 共19页
碟行客户信息管理系统Word格式.docx_第2页
第2页 / 共19页
碟行客户信息管理系统Word格式.docx_第3页
第3页 / 共19页
碟行客户信息管理系统Word格式.docx_第4页
第4页 / 共19页
碟行客户信息管理系统Word格式.docx_第5页
第5页 / 共19页
碟行客户信息管理系统Word格式.docx_第6页
第6页 / 共19页
碟行客户信息管理系统Word格式.docx_第7页
第7页 / 共19页
碟行客户信息管理系统Word格式.docx_第8页
第8页 / 共19页
碟行客户信息管理系统Word格式.docx_第9页
第9页 / 共19页
碟行客户信息管理系统Word格式.docx_第10页
第10页 / 共19页
碟行客户信息管理系统Word格式.docx_第11页
第11页 / 共19页
碟行客户信息管理系统Word格式.docx_第12页
第12页 / 共19页
碟行客户信息管理系统Word格式.docx_第13页
第13页 / 共19页
碟行客户信息管理系统Word格式.docx_第14页
第14页 / 共19页
碟行客户信息管理系统Word格式.docx_第15页
第15页 / 共19页
碟行客户信息管理系统Word格式.docx_第16页
第16页 / 共19页
碟行客户信息管理系统Word格式.docx_第17页
第17页 / 共19页
碟行客户信息管理系统Word格式.docx_第18页
第18页 / 共19页
碟行客户信息管理系统Word格式.docx_第19页
第19页 / 共19页
亲,该文档总共19页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

碟行客户信息管理系统Word格式.docx

《碟行客户信息管理系统Word格式.docx》由会员分享,可在线阅读,更多相关《碟行客户信息管理系统Word格式.docx(19页珍藏版)》请在冰点文库上搜索。

碟行客户信息管理系统Word格式.docx

staticintn=0;

floattotalmoney=0;

voidprint();

//定义一个客户类

classwork

{//私有成员其中包括客户号、姓名、年龄、工作、入会时间、性别、地址、入会资金

private:

unsignedintsno;

//编号

intage;

//年龄

charname[20];

//姓名

charworks[15];

//工作

inttimes;

//时间

floatmoney;

//入会资金

charsex;

//性别

intvalue;

//共有成员

public:

voidgetdata()//录入客户信息函数

{

value=1;

cout<

<

"

客户号姓名性别年龄工作入会资金入会时间:

;

'

\n'

cin>

>

sno>

name>

sex>

age>

works>

money>

times;

}

voiddisplay();

int&

get_value()//函数返回值为引用时,可以修改函数返回值。

{returnvalue;

unsignedintget_sno()//得到客户号

{returnsno;

char*get_name()//得到客户姓名

{returnname;

float&

get_money()//得到客户资金

{returnmoney;

intget_times()//得到客户时间

{returntimes;

intget_age()//得到客户年龄

{returnage;

};

voidwork:

:

display()//输出客户信息函数

输出信息:

if(get_value()==1)

setiosflags(ios:

left)//输出做对其

客户号"

\t'

姓名"

性别"

年龄"

工作"

入会资金"

入会时间"

endl;

left)

sno<

name<

sex<

age<

works<

money<

times<

elsecout<

客户号为"

已被删除。

//录入客户信息

voidInput()

ofstreamoutfile("

work.text"

ios:

out);

//以输出方式建立work文档文本文件

if(!

outfile)

cerr<

Can'

topenwork.text."

exit

(1);

workOne;

setw(5)<

输入职入会资金料:

客户总人数为:

n;

for(inti=1;

i<

=n;

i++)

第"

个客户"

One.getdata();

outfile.write((char*)&

One,sizeof(One));

outfile.close();

//输出客户信息

voidPutout()

ifstreaminfile("

in);

infile)

texportfromwork.text."

workTwo;

infile.read((char*)&

Two,sizeof(Two));

while(infile)

Two.display();

infile.read((char*)&

infile.close();

//按客户号查询

voidFind1()

inti=1;

floatmoney;

workThree;

ifstreaminput("

input)

请输入客户号:

sno;

input.read((char*)&

Three,sizeof(Three));

while(input)

if(Three.get_sno()==sno)

输出查询结果:

Three.display();

money=Three.get_money();

if(money<

1)

您的资金已低于1元,请尽快冲值"

break;

if(i==n)cout<

无此人信息,查找无效!

input.read((char*)&

i++;

input.close();

//按姓名查询

voidFind2()

ifstreamfile("

file)

输入要查询的姓名:

name;

file.read((char*)&

while(file)

if(!

strcmp(Three.get_name(),name))

//查询客户信息

voidFind()

intsel;

do

请选择查询方式:

setw(10)<

1:

客户号2:

姓名3:

退出:

sel;

switch(sel)

case1:

Find1();

case2:

Find2();

}while(sel==1||sel==2);

//添加客户信息

voidAdd()

intj=1,i;

最多能增添三次数据,请输入你要添加的次数:

i;

fstreamoutapp("

app);

outapp)

toutappwork.text."

workFour;

添加数据:

Four.getdata();

outapp.write((char*)&

Four,sizeof(Four));

outapp.close();

if(j==3)

{cout<

已添加三次,你无权再输入."

}while(j++<

i);

n++;

//客户信息删除

voidDelete()

inti=0,j=1;

fstreamoutdel("

in|ios:

outdel)

workSix;

outdel.seekg(0);

//存入文件时从头开始

输入要删除的客户号:

while(!

outdel.eof())//文件结束

outdel.seekp(sizeof(work)*i);

//不能用seekg(sizeof(work)*i)!

outdel.read((char*)&

Six,sizeof(Six));

if(sno==Six.get_sno())

Six.get_value()=0;

//

outdel.write((char*)&

//只有写入work.text时,才能起到修改的作用。

if(j==n)cout<

不存在此人信息,删除无效。

j++;

outdel.close();

************************************************"

//客户数据修改

voidAlter()

{intf;

floatmoney,a;

workthree;

fstreaminput("

texportfromwork.txt."

three,sizeof(three));

我要出租:

[1]****我要充值[0]"

//选择操作

f;

if(f==1)//出租活动

money=three.get_money();

money--;

three.get_money()=money;

出租成功!

您当前余额为:

元"

if(f==0)//充值

请输入冲的钱数"

a;

three.get_money()=three.get_money()+a;

three.get_money()<

input.write((char*)&

//客户信息统计

voidtongji()

{fstreaminput("

inttime1,time2;

统计特定年龄段人数:

输入[1]"

统计特定时间段资金总数:

输入[0]"

intf;

//操作命令符

floatbig,small,d=0;

intnum=0,big1=0;

if(f==1)

输入最大最小的年龄"

//输入最大最小的年龄

最大:

big;

最小:

small;

for(inti=0;

i++)//n

{big1=three.get_age();

if(big1>

=small&

&

big1<

=big)num++;

}//每找到一个在范围内的记数加1

从"

big<

岁到"

small<

岁的人数是:

num<

人"

//输出结果,没有是输出0

if(f==0)

请输入时间上限和下限"

inthead,end;

开始时间:

time1;

head=time1;

末端时间:

time2;

end=time2;

if(three.get_times()>

=head&

three.get_times()<

=end)

{d=three.get_money();

totalmoney=totalmoney+d;

}//找到入会时间在范围的资金累加一次

time1<

到"

time2<

总资金是:

totalmoney<

//结果

*****************************************************************"

voidMenu()

请选择功能"

endl

'

录入客户信息2:

输出客户信息3:

查询"

<

4:

添加客户信息5:

统计客户信息6:

客户数据修改"

endl//修改输入的距离

7:

客户信息删除其它:

注意:

请勿输入相同的编号以免造成重复"

Input();

Putout();

case3:

Find();

case4:

Add();

case5:

tongji();

case6:

Alter();

case7:

Delete();

}while(sel>

=1&

sel<

=7);

voidmain()

charm;

欢迎阅读本程序!

敬请提出建议!

y:

运行程序其他:

退出程序"

m;

switch(m)

case'

y'

Menu();

}//case后面跟的是常变量。

}while(m=='

);

}

3.2运行结果

3.C++课程设计过程总结:

“这次课程设计基本上含盖了大学一年纪学习到的C++语言知识点,课设题目要求不仅要求对课本知识有较深刻的了解,同时要求程序设计者有较强的思维和动手能力。

这次课设使我了解我编程思想和编程技巧,也认识了软件生命周期的各个环境,包括构思、设计、编写、调试。

编程的风格也很重要,同学只关心程序运行的结果,而对程序代码的结构的良好丝毫不在意。

这是非常不可取的,如果我们希望将来从事编程工作,在这一点上该引起足够的重视。

这是严谨的态度,很重要!

做课设不仅让我修补了以前学习的漏洞,也让我知道一个道理:

编程需要兴趣和实际动手。

这应该可以借鉴在老师的教学工作上。

创新思维至关重要,这不仅让我们写出精简的代码,也有助于开发出高效的程序。

4.参考书目

[1]谭浩强,《C++程序设计》,北京,清华大学出版社,2008年.

5.程序流程图

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

当前位置:首页 > 工作范文 > 制度规范

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

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