Newbie question on Structures
(Optional reading as I introduce myself) I'm a Java Programmer with a couple years of experience, teaching myself how to write C++. I've got a pretty good handle on most of the basic concepts that are common between Java and C++, and I generally learn best by doing rather than reading.(/Introduction off).
My currect project is to create a "Galaxy" of random types of stars, each containing a system of planets of variable type and size.
I currently have code that functions well that creates the stars by color and sorts them. But to progress further, I am stuck. At some point later I will be assigning each of these stars a random name, but haven't implemented that yet.
My question: I was thinking, that the easiest way for me to do this effectively would be first to create a Structure Planet which would contain variables Planet Size and Planet Envrionment, and then create another Structure Starsystem which would contain a variable number of the Planet Structures.
Is this legal in C++? To place one Structure within another Structure? For example...
Is this legal? If so, how does one access the Structure inside of the Structure?
sol.num_planets = 9;
Would this work?
TIA, Structures are pretty new to me in concept and I'm trying to get a grasp of how to use them.
sol.insystem.size = 100;