vc++6.0下运行,其他软件不知道……
这个我是抄袭的,搜了好多一样的,但是都无法运行,找不到谁先写的,所以就不做转载了。
因为要做大二下学期的课程设计,就在网上搜、在这上面搜,搜是搜到了但是无法运行,没办法就只能自己稍微改改,看看哪里有错,没想到居然真被我改的能运行了。改的是能在vc++6.0上能运行,文档就不放了,嘿嘿,下面看代码,如果有错请指出来
#include<windows.h>
#include<iostream>
#include<fstream>
#include<iomanip>
#include<conio.h>
using namespace std;
#define N 20 //车辆最大存储量20
#define OilPrice 8.0 //油价8元每升
class Manager;
class Cars //汽车类
{
private:
int num; //编号
char pnum[20]; //车牌号
char made[20]; //制造公司
double time; //购买时间(多少个月)
int type; //型号(1-大客车,2-小轿车,3-卡车) 公共变量
double km; //总公里数
int cost; //基本维护费用
int RoadFee; //养路费
double OilKm; //耗油量/公里
double AllCount; //累计总费用
friend Manager;
};
class Manager //总的类
{
private:
Cars car[N]; //汽车数
int people[N]; //最大载客量(大客车)
int coach[N]; //箱数(小轿车)
int weight[N]; //载重量(卡车)
int top; //记录当前车辆数量
public:
Manager(){top = 0;}//车辆初始值为0 汽车总数
void add(); //添加车辆
void search(); //查询车辆
void show(); //显示车辆信息库
void edit(); //编辑功能
void delet(); //删除车辆
void sum(); //统计信息
void read(); //读出车辆信息
void write(); //车辆信息存盘
void jiemian(); //总界面
};
void Manager::add() //添加车辆 调用总的类之中的add函数
{
int a = 0, x, y; // x代表车辆编号
while(1)
{
if(top < N) //判断top当前已存车辆数小于汽车最大存储数N
{
cout<<"请输入需添加的车辆信息"<<endl;
cout<<"车辆编号:";
cin>>x;
for(int j=0; j<top;j++) //判断编号是否重复
{
if (car[j].num==x)
{
cout<<"编号重复,添加失败! 即将跳转至功能主界面"<<endl;
a++; //如果重复++,此时a不为0
break;
}
}
if(a==0) //此时编号不重复
{
car[top].num = x;
cout<<"车牌号:";
cin>>car[top].pnum;
cout<<"车辆制造公司:";
cin>>car[top].made;
cout<<"购买时间:";
cin>>car[top].time;
cout<<"养路费:";
cin>>car[top].RoadFee;
cout<<"车辆型号(1-大客车,2-小轿车,3-卡车):";
cin>>car[top].type;
while(!(car[top].type==1||car[top].type==2||car[top].type==3)) //判断输入指令是否为1-3
{
cout<<"输入指令号错误,重输:";
cin>>car[top].type;
}
cout<<"总公里数:";
cin>>car[top].km;
if( car[top].type==1) //此时是1-大客车,
{
cout<<"最大载客量:";
cin>>people[top];
car