fork(1) download
  1. #include <iostream>
  2.  
  3. struct Point {
  4. int x_, y_;
  5. Point(int x, int y) : x_(x), y_(y) {}
  6. };
  7.  
  8. struct Vector {
  9. int x_, y_;
  10. Vector(int x, int y) : x_(x), y_(y) {}
  11. };
  12.  
  13. int main() {
  14. Point p(3, 3);
  15. Vector v(2, -4);
  16. Point p2(p.x_ - v.x_, p.y_ - v.y_);
  17. std::cout << "Point p: (" << p.x_ << "," << p.y_ << ")\n";
  18. std::cout << "Vector v: (" << v.x_ << "," << v.y_ << ")\n";
  19. std::cout << "Point p2: (" << p2.x_ << "," << p2.y_ << ")\n";
  20. }
Success #stdin #stdout 0s 3140KB
stdin
Standard input is empty
stdout
Point p:  (3,3)
Vector v: (2,-4)
Point p2: (1,7)