Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2341801
  • 博文数量: 816
  • 博客积分: 10000
  • 博客等级: 上将
  • 技术积分: 5010
  • 用 户 组: 普通用户
  • 注册时间: 2008-12-17 17:57
文章分类

全部博文(816)

文章存档

2011年(1)

2008年(815)

分类:

2008-12-17 18:04:36

#include
#define BIKE_STD 0
#define MOTOBIKE_STD 2
#define CAR_STD 5
#define BUS_STD 8
#define LARGETRUCK_STD 15
using namespace std;
class charge_system{
public:
charge_system();
void bike_charge();
int bike_money();
void motobike_charge();
int motobike_money();
void car_charge();
int car_money();
void bus_charge();
int bus_money();
void largetruck_charge();
int largetruck_money();
int get_totalmoney();
int get_totalnum();
protected:
int bike_num,motobike_num,car_num,bus_num,largetruck_num;
static int total_num;
static int total_money;
};
 int charge_system::total_money=0;
 int charge_system::total_num=0;
charge_system::charge_system()
{
bike_num=0;
motobike_num=0;
car_num=0;
bus_num=0;
largetruck_num=0;
}

//================================
void  charge_system::bike_charge()
{
    total_num++;
bike_num++;
}
int charge_system::bike_money()
{
return bike_num*BIKE_STD;
}

//================================
void charge_system::motobike_charge()
{
total_num++;
motobike_num++;
}
int charge_system::motobike_money()
{
return motobike_num*MOTOBIKE_STD;
}
//================================
void charge_system::largetruck_charge()
{
total_num++;
largetruck_num++;
}

int charge_system::largetruck_money()
{
return largetruck_num*LARGETRUCK_STD;
}

//================================
void charge_system::car_charge()
{
total_num++;
car_num++;
}
int charge_system::car_money()
{
return car_num*CAR_STD;
}
//===============================
void charge_system::bus_charge()
{
total_num++;
bus_num++;
}
int charge_system::bus_money()
{
return bus_num*BUS_STD;
}
//==============================
int charge_system::get_totalmoney()
{
total_money=bike_money()+motobike_money()+car_money()+bus_money()+largetruck_money();
return total_money;
}
int charge_system::get_totalnum()
{
return total_num;
}

void main()
{  
int i,j,k;
charge_system system1;

do{
cout<<"输入:1 进入收费状态  2 进入查询状态 0 退出系统"< cin>>i;
switch(i)
{
case 1:
{
cout<<'\t'<<"收费状态"< cout<<"输入: 1 自行车 2 摩托车 3 小车 4 客车与货车 5大型货车 0 退出收费 "<
do{

cin>>j;

switch(j)
{
case 1: system1.bike_charge();
     cout<<"自行车通过1"< break;
case 2: system1.motobike_charge();
     cout<<"摩托车通过1"< break;
case 3: system1.car_charge();
     cout<<"小车通过1"< break;
case 4: system1.bus_charge();
     cout<<"客车或货车通过1"< break;
case 5: system1.largetruck_charge();
    cout<<"大货车通过1"< break;
case 0: cout<<"退出收费系统"<      break;
default: cout<<"输入0-5进行操作!"< }
}while(j!=0);
}break;
case 2:
{
cout<<'\t'<<"查询状态"< cout<<"输入: 1 总费用 2 总车辆 0 退出"< do{
cin>>k;
switch(k)
{
case 1:
cout<<"总费用:"< case 2:
cout<<"总车辆:"< case 0:
cout<<"退出查询"< default:
cout<<"输入0-2进行操作"< }
}while(k!=0);
}break;
case 0:
cout<<"退出系统"< break;
default:
cout<<"输入0-3进行操作"< }
}while(i!=0);
}


--------------------next---------------------

阅读(983) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~