基于C的车辆信息管理系统.docx

上传人:b****1 文档编号:1350051 上传时间:2022-10-21 格式:DOCX 页数:15 大小:48.71KB
下载 相关 举报
基于C的车辆信息管理系统.docx_第1页
第1页 / 共15页
基于C的车辆信息管理系统.docx_第2页
第2页 / 共15页
基于C的车辆信息管理系统.docx_第3页
第3页 / 共15页
基于C的车辆信息管理系统.docx_第4页
第4页 / 共15页
基于C的车辆信息管理系统.docx_第5页
第5页 / 共15页
点击查看更多>>
下载资源
资源描述

基于C的车辆信息管理系统.docx

《基于C的车辆信息管理系统.docx》由会员分享,可在线阅读,更多相关《基于C的车辆信息管理系统.docx(15页珍藏版)》请在冰豆网上搜索。

基于C的车辆信息管理系统.docx

基于C的车辆信息管理系统

 

基于C的车辆信息管理系统

 

哈尔滨理工大学

软件学院

课程实践报告

 

课程设计C++课程实践

题目车辆信息管理

班级软件15-7

学生***

学号***

指导教师***

 

 

管理系统的功能说明

1.存储数据的描述

2.概要设计说明书

3.源程序

4.测试分析(用户操作手册)

5.总结报告

 

1.管理系统功能说明

车辆管理系统有五项功能:

1.增加车辆信息

2.浏览所有的车辆信息

3.查询车辆信息(按车辆品牌和型号)

4.修改车辆信息(经过型号查找再修改)

5.退出系统

 

2.存储数据的描述

由于本学期c++关于类的知识学的不精,我定义的是上学期学习的结构体,并利用文件存储fopen与fclose产生一个名为information的txt文件存储数据,方便程序的读写。

 

3.概要设计说明书

 

4.源程序

#include

#include

#include

#include

usingnamespacestd;

typedefstructcar

{

charBrand[20];

charModel[20];

charManufacturar[20];//manufacturer厂家

charPrice[30];

charLinkman[20];

structcar*next;

}car,*cheliang;

intinit(cheliang&s);

voidshuru(cheliang&s);

voidshuchu(cheliang&s);

voidfind(cheliang&s);

voidfindBrand(cheliang&s);

voidfindModel(cheliang&s);

voidchange(cheliang&s);

voidputfile(cheliang&s);

voidgetfile(cheliang&s);

voidwelcome();

 

voidPrintfSurface()

{

cout<<"**************************************************************"<

cout<<"**"<

cout<<"*WelcomeToUse车辆信息管理系统*"<

cout<<"**"<

cout<<"*By:

软件15-7刘子墨*"<

cout<<"**************************************************************"<

cout<<"初始密码123456"<

}

 

intjud=0;

voidwelcome()

{

intb;

charcode[7];

cout<<"请输入密码:

"<

while(b!

=3)

{

 

cin>>code;

b++;

if(strcmp(code,"123456")!

=0)

{

if(b!

=3)

cout<<"密码错误,请重新输入:

"<

continue;

}

else

{

jud=1;

break;

}

}

 

}

intmain()

{

system("color1e");

PrintfSurface();

welcome();

if(jud==0)

{

return0;

}

system("cls");

cheliangs;

init(s);

cout<<"\t\t\t&&&&&&&&&&&&&&&&&&&&&&&&&&&"<

cout<<"\t\t\t&&"<

cout<<"\t\t\t&车辆信息管理系统&"<

cout<<"\t\t\t&软7刘子墨&"<

cout<<"\t\t\t&&&&&&&&&&&&&&&&&&&&&&&&&&&"<

cout<<""<

cout<

while

(1)

{

inti;

mainint:

cout<<"请选择相关操作:

"<

cout<<"3.查询车辆信息."<

"<

cin>>i;

if(i<=0||i>5)

{

cout<<"数字错误,请重新输入!

"<

gotomainint;

}

switch(i)

{

case1:

shuru(s);

break;

case2:

shuchu(s);

putfile(s);

break;

case3:

find(s);

break;

case4:

change(s);

break;

case5:

cout<<"感谢使用"<

exit(0);

}

}

}

intinit(cheliang&s)

{

s=(cheliang)malloc(sizeof(car));//sizeofPascal的一种内存容量度量函数malloc动态内存分配

if(s)

{

s->next=NULL;

return0;

}

elsereturn-1;

}

voidshuru(cheliang&s)//insert

{

cout<

cheliangp,q;

p=(cheliang)malloc(sizeof(car));

cout<<"请输入车辆信息:

"<

cout<<"品牌:

";

cin>>p->Brand;

cout<

cout<<"型号:

";

cin>>p->Model;

cout<

cout<<"厂家:

";

cin>>p->Manufacturar;

cout<

cout<<"价格:

";

cin>>p->Price;

cout<

cout<<"联系人:

";

cin>>p->Linkman;

cout<

q=s;

while(!

(q->next==NULL)&&(q->next->ModelModel))

q=q->next;

p->next=q->next;

q->next=p;

}

voidshuchu(cheliang&s)

{

inta;

a=0;

cheliangp;

p=s->next;

cout<<"品牌"<<"型号"<<"厂家"<<"价格"<<"联系人"<

while(p)

{

a++;

cout<Brand<<""<Model<<""<Manufacturar<<""<Price<<""<Linkman<<""<

p=p->next;

}

cout<

if(a==0)

cout<<"还没有车辆信息!

"<

}

voidfind(cheliang&s)

{

findl:

cout<<"请选择查找方法:

"<

cout<<"请选择:

";

intk;

cin>>k;

if(k<0||k>2)

{

cout<<"请输入正确数字"<

gotofindl;

}

switch(k)

{

case1:

findBrand(s);

break;

case2:

findModel(s);

break;

}

}

voidfindBrand(cheliang&s)//findbyname

{

cheliangp;

p=s->next;

cout<<"请输入品牌:

";

charBrand[20];

intj;

j=0;

cin>>Brand;

cout<<"你要查找的资料是:

"<

cout<<"品牌"<<"型号"<<"厂家"<<"价格"<<"联系人"<

while(p)

{

if(strcmp(p->Brand,Brand)==0)

{

cout<Brand<<""<Model<<""<Manufacturar<<""<Price<<""<Linkman<<""<

j++;

}

p=p->next;

}

cout<

if(j==0)

cout<<"厂家错误!

"<

}

voidfindModel(cheliang&s)//findbynumber

{

cheliangp;

p=s->next;

cout<<"请输入型号:

";

charModel[20];

intj;

j=0;

cin>>Model;

cout<<"你要查找的资料是:

"<

cout<<"品牌"<<"型号"<<"厂家"<<"价格"<<"联系人"<

while(p)

{

if(strcmp(p->Model,Model)==0)

{

cout<Brand<<""<Model<<""<Manufacturar<<""<Price<<""<Linkman<<""<

j++;

}

p=p->next;

}

cout<

if(j==0)

cout<<"对不起,没这车。

"<

}

voidchange(cheliang&s)//modifay

{

cheliangq,p,l,m;

intj;

j=0;

q=s->next;

l=s;

m=s;

cout<<"请输入要修改的型号:

";

charModel[20];

cin>>Model;

cout<<"品牌"<<"型号"<<"厂家"<<"价格"<<"联系人"<

while(q)

{

if(strcmp(q->Model,Model)==0)

{

cout<<"你要修改的信息是:

"<

cout<Brand<<""<Model<<""<Manufacturar<<""<Price<<""<Linkman<<""

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

当前位置:首页 > 幼儿教育 > 幼儿读物

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1