Periodic Table
Ok, so i am making a win32 gui application that is all about chemistry. I just love chemistry, and it is my favorite subject in school, don't ask why (i like to make bombs
).
Obviously i need to include the periodic table in there somehow, so i decided to make a struct for elements, and it looks like this:
Now using this Element structure I define each element in the periodic table like this:
My problem is that if i use this method, it will take me a while to get the whole periodic table of elements recorded in my header file if i have to define each detail about each single one.
What i was wondering is how would you guys approach this.
Would you guys just go with the structure idea? or just recommend a class?
Or just something genious that hasn't come accross my mind.
Thanks in advance.
).Obviously i need to include the periodic table in there somehow, so i decided to make a struct for elements, and it looks like this:
Code:
struct Element
{
char* name;
char* id;
int atomic_number;
double atomic_mass;
};
Now using this Element structure I define each element in the periodic table like this:
Code:
Element hydrogen; hydrogen.name = "Hydrogen"; hydrogen.atomic_number = 1; hydrogen.atomic_mass = 1.008; hydrogen.id = "H"; Element lithium; lithium.name = "Lithium"; lithium.atomic_number = 3; lithium.atomic_mass = 6.94; lithium.id = "Li"; // etc............
My problem is that if i use this method, it will take me a while to get the whole periodic table of elements recorded in my header file if i have to define each detail about each single one.
What i was wondering is how would you guys approach this.
Would you guys just go with the structure idea? or just recommend a class?
Or just something genious that hasn't come accross my mind.
Thanks in advance.

![=]](/forum/images/emotions/=].gif)
