#include<iostream>
#include<string>
using namespace std;
class engine
{
private: int capacity;
public: engine(int c)
{
capacity=c;
}
public: int get_engine()
{
return capacity;
}
public: void show()
{
cout<<"Capacity of The engine is == "<<capacity<<endl;
}
};
class car
{
private: string car_name;
engine *myengine;
public: car(int cap, string name)
{
myengine= new engine(cap);
car_name=name;
}
public: void show()
{
cout<<"Company name == "<<car_name<<endl;
myengine->show();
}
};
int main()
{
string car_name;
int capacity_of_car;
cout<<"Enter the Name of car == "<<endl;
getline(cin,car_name);
cout<<"Enter The Capacity of the car == ";
cin>>capacity_of_car;
car mycar(capacity_of_car,car_name);
mycar.show();
getchar();
getchar();
return 0;
}
#include<string>
using namespace std;
class engine
{
private: int capacity;
public: engine(int c)
{
capacity=c;
}
public: int get_engine()
{
return capacity;
}
public: void show()
{
cout<<"Capacity of The engine is == "<<capacity<<endl;
}
};
class car
{
private: string car_name;
engine *myengine;
public: car(int cap, string name)
{
myengine= new engine(cap);
car_name=name;
}
public: void show()
{
cout<<"Company name == "<<car_name<<endl;
myengine->show();
}
};
int main()
{
string car_name;
int capacity_of_car;
cout<<"Enter the Name of car == "<<endl;
getline(cin,car_name);
cout<<"Enter The Capacity of the car == ";
cin>>capacity_of_car;
car mycar(capacity_of_car,car_name);
mycar.show();
getchar();
getchar();
return 0;
}
thank you......
ReplyDelete