fork download
  1. #include <iostream>
  2. namespace math2d {
  3.  
  4. //A vector on a 2D Plane
  5. typedef struct Vector2
  6. {
  7. //x & y coords
  8. double x;
  9. double y;
  10. } Vector2;
  11.  
  12. }
  13.  
  14. int main() {
  15.  
  16. math2d::Vector2 a = {10.0, -10.0};
  17. math2d::Vector2 b = a;
  18.  
  19. printf("a.x:%f\ta.y:%f\nb.x:%f\tb.y:%f\n", a.x, a.y, b.x, b.y);
  20.  
  21. getchar();
  22. return 0;
  23. }
Success #stdin #stdout 0s 3300KB
stdin
Standard input is empty
stdout
a.x:10.000000	a.y:-10.000000
b.x:10.000000	b.y:-10.000000