Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- class Auto {
- private:
- std::string name;
- std::string model;
- float speed;
- float weight;
- int doors;
- public:
- void init(std::string name, std::string model, float speed, float weight, int doors) {
- name = name;
- model = model;
- speed = speed;
- weight = weight;
- doors = doors;
- };
- void show_auto() {
- std::cout << "Название: " << name << std::endl;
- std::cout << "Модель: " << model << std::endl;
- std::cout << "Скорость: " << speed << "км/ч" << std::endl;
- std::cout << "Вес: " << weight << std::endl;
- std::cout << "Кол-во дверей: " << doors << std::endl;
- }
- };
- int main(int argc, const char * argv[]) {
- Auto audi;
- audi.init("Audi", "Slts2015", 180, 400, 2);
- audi.show_auto();
- return 0;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement