I'm trying to code a console minigame (for fun), and I need to create a map(graph) with a predefined number of rooms(vertices).
I'd like to define a class room
and create instances of that class that will be assigned to variable names like room_1
, room_2
and so on.
My problem is, that I don't know how to create these variable names. To cut a long story short, I need a tool/tip/trick to create preformated variable names on demand.
F.i let's say that MAX_R=5
, then I'll need variables room_1
to room_5
.
Any ideas?