josiftepe

Untitled

Nov 22nd, 2020
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. class Player {
  6. private:
  7.     double x, y;
  8.     string name;
  9.     int health_points;
  10. public:
  11.     Player(double _x, double _y, string _name, int _health_points) {
  12.         x = _x;
  13.         y = _y;
  14.         name = _name;
  15.         health_points = _health_points;
  16.     }
  17.     void print_player() {
  18.         cout << x << " " << y << " " << name << " " << health_points << endl;
  19.     }
  20. };
  21. int main()
  22. {
  23.     Player david(1.0, 6.7, "david", 100);
  24.    
  25.     david.print_player();
  26.  
  27.  
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment