This is a section from what I have now (only the first 2 elements to keep it short):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
void FuncElements()
{
system("cls");
system("title Periodic Table ---Made by Drue Peters");
MainScreen:
WaitTime();
///////////////////////////////////////////////////////////
cout << "Type in the name of the element, the symbol, atomic mass or atomic number.\n"
<< " -";
string Element;
cin >> Element;
//////////////////////////////////////////////////////////////// 1
////////////////// Hydrogen //////////////////////////////////
//////////////////////////////////////////////////////////////////
if (Element == "Hydrogen" || Element == "hydrogen" || Element == "1" ||
Element == "h" || Element == "H" || Element == "1.008")
{
Hydrogen:
system("cls");
system("title Hydrogen");
cout << " Hydrogen : Nonmetal \n\n\n"
<< "Symbol : H\n"
<< "Atomic Number : 1\n"
<< "Neutrons : 0\n"
<< "Atomic Mass : 1.008\n"
<< "State of matter : Gas\n"
<< "Electrons in Outer Energy level : 1";
system("pause>nul");
goto MainScreen;
}
//////////////////////////////////////////////////////////////////// 2
///////////////////// Helium ///////////////////////////////////////
////////////////////////////////////////////////////////////////////
if (Element == "Helium" || Element == "helium" || Element == "2" ||
Element == "HE" || Element == "he" || Element == "He" || Element == "hE" || Element == "4.003")
{
Helium:
system("cls");
system("title Helium");
cout << " Helium : Nonmetal \n\n\n"
<< "Symbol : He\n"
<< "Atomic Number : 2\n"
<< "Neutrons : 2\n"
<< "Atomic Mass : 4.003\n"
<< "State of matter : Gas\n"
<< "Electrons in Outer Energy level : 2\n"
<< "This is a noble gas.";
system("pause>nul");
goto MainScreen;
}
|
As of now, I'm listing every element into the function
, and you can only search by specifics. Name, symbol, atomic number, and atomic mass.
I want to set it up so you can type in "gas" (or generals) and it shows a list of all the gas elements
with a number in front of it like:
1. Hydrogen
2. Helium
and those two elements in the gas header will be listed, then when the user presses a 1
it uses a goto command to go to the hydrogen information. The reason I want it to be set up
this way is so I can have more than one list and keep the elements separated by the type.
Hydrogen can be in 3 lists: nonmetal, gas, and representative. It would keep it neater and I think easier, but it also gives me practice with including files.