#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<iostream.h>
#include<conio.h>
#include<fstream.h>
class Car //定义一个类
{
private:
char cheXing[20],cheHao[20],people[30],time[30]; //定义成员变量
int ruKou,gongLi;
double feiYong;
public:
void sum() //计算费用
{
int a,b,c;
switch (ruKou)
{
system("cls"); //
case 1:
if(a) feiYong=gongLi*0.5;
else if(b) feiYong=gongLi*0.4;
else if(c) feiYong=gongLi*0.3;
cout<<"所收费用为:"<<feiYong<<"元"<<endl;
break;
case 2:
if(a) feiYong=gongLi*0.5;
else if(b) feiYong=gongLi*0.4;
else if(c) feiYong=gongLi*0.3;
cout<<"所收费用为:"<<feiYong<<"元"<<endl;
break;
case 3:
if(a) feiYong=gongLi*0.5;
else if(b) feiYong=gongLi*0.4;考导游证需要什么条件
else if(c) feiYong=gongLi*0.3;
cout<<"所收费用为:"<<feiYong<<"元"<<endl;
break;
}
}
void write() //记录信息早餐食谱大全图片
{
int a,b,c;
cout<<"请输入路口(1、2、3):"<<endl;
cin>>ruKou;
cout<<"请输入车型(输入a,b,c. 'a-代表大型车,b-代表中型车,c-代表小型车'):"<<endl;
cin>>cheXing;
cout<<"请输入车牌号:"<<endl;
cin>>cheHao;
cout<<"请输入路程(单位为公里):"<<endl;
cin>>gongLi;
cout<<"请输入收费人:"<<endl;
cin>>people;
cout<<"请输入日期(格式:****-**-** . 年-月-日):"<<endl;
cin>>time;
qq搞笑签名
}
void show() //打印记录情况
{
cout<<"车型"<<" "<<"车号"<<" "<<"费用"<<" "<<"收款人"<<" "<<"日期"<<endl;
cout<<"________________________________________________________________"<<endl;
cout<<cheXing<<" "<<cheHao<<" "<<feiYong<<" "<<people<<" "<<time<<endl;
}
int save() //记录信息写入3个文档
{
if(ruKou==1)
{
ofstream sf("记录数据1.txt",ios::app);
if(!sf)
{
cout<<"文件打开失败"<<endl;
return -1;
}
sf<<cheXing<<" "<<cheHao<<" "<<feiYong<<" "<<people<<" "<<time<<endl;
sf.close();
cout<<"\n数据已保存成功!\n"<<endl;
return 0;
}
if(ruKou==2)
{
ofstream sf("记录数据2.txt",ios::app);
if(!sf)
{
cout<<"文件打开失败"<<endl;
return -1;
}
sf<<cheXing<<" "<<cheHao<<" "<<feiYong<<" "<<people<<" "<<time<<endl;
sf.close();
cout<<"\n数据已保存成功!\n"<<endl;
return 0;
}
if(ruKou==3)
{
ofstream sf("记录数据3.txt",ios::app);
if(!sf)
{
cout<<"文件打开失败"<<endl;
return -1;
}
女奥特曼 sf<<cheXing<<" "<<cheHao<<" "<<feiYong<<" "<<people<<" "<<time<<endl;
sf.close();
cout<<"\n数据已保存成功!\n"<<endl;
return 0;
}
}
int tongJi() //写入统计信息
{
ofstream tj("统计数据.txt",ios::app);
if(!tj)
{高速公路过路费
cout<<"文件打开失败"<<endl;
return -1;
}
tj<<ruKou<<" "<<cheXing<<" "<<people<<endl;
tj.close();
return 0;
}
int openTj() //打开统计信息文档
{
char d;
ifstream ot("统计数据.txt");
cout<<"路口"<<" "<<"车型"<<" "<<"收款人"<<endl;
cout<<"________________________________"<<endl;
while((())!=EOF)
cout<<d;
return 0;
}
int opensf1() //打开记录信息文档1
{
char ch;
ifstream of("记录数据1.txt");
cout<<"车型"<<" "<<"车号"<<" "<<"费用"<<" "<<"收款人"<<" "<<"日期"<<endl;
cout<<"_________________________________________________________________"<<endl;
cout<<cheXing<<" "<<cheHao<<" "<<feiYong<<" "<<people<<" "<<time<<endl;
while((())!=EOF)
cout<<ch;
return 0;
}
int opensf2() //打开记录信息文档2
{
char ch;
ifstream of("记录数据2.txt");
cout<<"车型"<<" "<<"车号"<<" "<<"费用"<<" "<<"收款人"<<" "<<"日期"<<endl;
cout<<"_________________________________________________________________"<<endl;
while((())!=EOF)
cout<<ch;
return 0;
}
int opensf3() //打开记录信息文档3
{
char ch;
ifstream of("记录数据2.txt");
cout<<"车型"<<" "<<"车号"<<" "<<"费用"<<" "<<"收款人"<<" "<<"日期"<<endl;
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论