Advertisement
Josif_tepe

Untitled

Sep 1st, 2021
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct point {
  5.     double x, y;
  6.     point(){ // empty constructor / default constructor
  7.         x = 0;
  8.         y = 0;
  9.     }
  10.    
  11.     point(double _x, double _y) { // parameterized constructor
  12.         x = _x;
  13.         y = _y;
  14.     }
  15. };
  16. int main() {
  17.     point p(30, 20);
  18.     cout << p.x << " " << p.y << endl;
  19.     return 0;
  20. }
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement