#include <iostream.h>
#include <string.h>
const int len=50;
class station
{
protected:
char fromstation[len];
char tostation[len];
public:
station(char fs[],char ts[])
{
strcpy(fromstation,fs);
strcpy(tostation,ts);
}
void inputvalue()
{
cout<<"enter from station:";
cin>>fromstation;
cout<<"enter to station:";
cin>>tostation;
}
void display()
{
cout<<"going from "<<fromstation<<" station to "<<tostation<<" station";
}
};
class mile
{
protected:
int mile;
public:
mile(int m)
{
mile=m;
}
void inputmile()
{
cout<<"enter mile:";
cin>>mile;
}
void display()
{
cout<<"is "<<mile<<" miles";
}
};
class price:public station,public mile
{
int price;
public:
price(char ff[],char tt[],int mm,int pp):station(ff,tt),mile(mm)
{
price=pp;
}
void getprice()
{
station::inputvalue();
mile::inputmile();
cout<<"enter price:";
cin>>price;
}
void display()
{
station::display();
mile::display();
cout<<",the price is "<<price<<endl;
}
};
void main()
{
price a("beijing","shanghai",1200,50);
a.display();
}