Advertisement
Guest User

Untitled

a guest
Apr 29th, 2020
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. #include <iostream>
  2.  
  3.  
  4. class Auto {
  5. private:
  6. std::string name;
  7. std::string model;
  8. float speed;
  9. float weight;
  10. int doors;
  11. public:
  12. void init(std::string name, std::string model, float speed, float weight, int doors) {
  13. name = name;
  14. model = model;
  15. speed = speed;
  16. weight = weight;
  17. doors = doors;
  18. };
  19.  
  20. void show_auto() {
  21. std::cout << "Название: " << name << std::endl;
  22. std::cout << "Модель: " << model << std::endl;
  23. std::cout << "Скорость: " << speed << "км/ч" << std::endl;
  24. std::cout << "Вес: " << weight << std::endl;
  25. std::cout << "Кол-во дверей: " << doors << std::endl;
  26. }
  27. };
  28.  
  29.  
  30. int main(int argc, const char * argv[]) {
  31.  
  32. Auto audi;
  33. audi.init("Audi", "Slts2015", 180, 400, 2);
  34. audi.show_auto();
  35.  
  36. return 0;
  37. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement