#include "iostream"
using namespace std;
class station{
public:
int oil;
void show();
void oiling(int);
station();
};
void station::show(){
cout<<"----주유소----\n남아있는 기름 : "<<oil<<endl;;
}
void station::oiling(int L){
oil-=L;
}
station::station(){
oil=500; //최초 기름의 양은 500L
}
class car{
public:
int oil;
void show();
void oiling(station *, int);
car();
};
void car::oiling(station *station, int L){
station->oiling(L);
oil+=L;
printf("자동차에 %d만큼 주유하였습니다.\n",L);
}
car::car(){
oil=10;
}
void car::show(){
cout<<"----자동차----\n남아있는 기름 : "<<oil<<endl;
}
int main(){
int L;
station Soil;
car chairman;
Soil.show();
chairman.show();
cout<<"----주유시스템----\n몇L를 주유합니까? : ";cin>>L;
chairman.oiling(&Soil, L);
Soil.show();
chairman.show();
return 0;
}