Structs
The members of an object can be accessed with the dot operator .
.
This code prints out x
of point_e
:
Point point_e{5, -2};
std::cout << point_e.x << std::endl; // Prints out 5.
Print out the x
and y
coordinate of the point_a
and point_b
variable in the format (x, y)
in one line each:
- Print out `point_a.x` and `point_a.y`
- Print out `point_b.x` and `point_b.y`