#include using namespace std; struct coordinates { int x; int y; }; enum coord { x, y }; void printCoordComp(coordinates cd, coord which) { switch (which) { case x : cout << cd.x << endl; break; case y : cout << cd.y << endl; break; } } int main() { coordinates position, pos2; coord c; c = x; position.x = 10; position.y = 7; pos2 = position; printCoordComp(pos2,c); cout << pos2.x << " " << pos2.y << endl; return 0; }