note WIP
[whatever.git] / cocp2.cpp
blobb591e3abb16d0e683d358c412730fb6c7600c2a0
1 #include<iostream>
2 #include<cstring>
3 #include<vector>
4 using namespace std;
6 struct element
8 int n;
9 short symbol; // two char bytes
10 char name[100]="Ununenium";
11 double mass;
14 vector<element> e;
16 inline void s(string _,string a,double b){element c;strcpy(c.name,a.c_str());c.n=e.size()+1;c.symbol=_.length()==1?(_[0]):((_[0]<<8)|(_[1]));c.mass=b;} // quick element add
17 inline bool equal_symbol(short a, short b){return (((a/0x100)==(b/0x100))||((a/0x100)-'A'+'a'==(b/0x100))||((a/0x100)-'a'+'A'==(b/0x100)))&&(a%0x100==b%0x100);}
19 int main(int argc, const char** argv)
21 s("H","Hydrogen",1.0080);
22 s("He","Helium",4.0026);
23 s("Li","Lithium",6.94);
24 s("Be","Beryllium",9.0122);
25 s("B","Boron",10.81);
26 s("C","Carbon",12.011);
27 s("N","Nitrogen",14.007);
28 s("O","Oxygen",15.999);
29 s("F","Fluorine",18.998);
30 s("Ne","Neon",20.180);
31 s("Na","Sodium",22.990);
32 s("Mg","Magnesium",24.305);
33 s("Al","",26.982);
34 s("Si","",28.085);
35 s("P","",30.974);
36 s("S","",32.06);
37 s("Cl","",35.45);
38 s("Ar","",39.95);
39 s("K","",39.098);
40 s("Ca","",40.078);
41 s("Sc","",44.956);
42 s("Ti","",47.867);
43 s("V","",50.942);
44 s("Cr","",51.996);
45 s("Mn","",54.938);
46 s("Fe","",55.845);
47 s("Co","",58.933);
48 s("Ni","",58.693);
49 s("Cu","",63.546);
50 s("Zn","",65.38);
51 s("Ga","",69.723);
52 s("Ge","",72.630);
53 s("As","",74.922);
54 s("Se","",78.971);
55 s("Br","",79.904);
56 s("Kr","",83.798);
57 s("Rb","",85.468);
58 s("Sr","",87.62);
59 s("Y","",88.906);
60 s("Zr","",91.224);
61 s("Nb","",92.906);
62 s("Mo","",95.95);
63 s("Tc","",97);
64 s("Ru","",101.07);
65 s("Rh","",102.91);
66 s("Pd","",106.42);
67 s("Ag","",107.87);
68 s("Cd","",112.41);
69 s("In","",114.82);
70 s("Sn","",118.71);
71 s("Sb","",121.76);
72 s("Te","",127.60);
73 s("I","",126.90);
74 s("Xe","",131.29);
75 s("Cs","",132.91);
76 s("Ba","",137.33);
77 s("La","",138.91);
78 s("Ce","",140.12);
79 s("Pr","",140.91);
80 s("Nd","",144.24);
81 s("Pm","",145);
82 s("Sm","",150.36);
83 s("Eu","",151.96);
84 s("Gd","",157.25);
85 s("Tb","",158.93);
86 s("Dy","",162.50);
87 s("Ho","",164.93);
88 s("Er","",167.26);
89 s("Tm","",168.93);
90 s("Yb","",173.05);
91 s("Lu","",174.97);
92 s("Hf","",178.49);
93 s("Ta","",180.95);
94 s("W","",183.84);
95 s("Re","",186.21);
96 s("Os","",190.23);
97 s("Ir","",192.22);
98 s("Pt","",195.08);
99 s("Au","",196.97);
100 s("Hg","",200.59);
101 s("Tl","",204.38);
102 s("Pb","",207.2);
103 s("Bi","",208.98);
104 s("O","",209);
105 s("At","",210);
106 s("Rn","",222);
107 s("Fr","",223);
108 s("Ra","",226);
109 s("Ac","",227);
110 s("Th","",232.04);
111 s("Pa","",231.04);
112 s("U","",238.03);
113 s("Np","",237);
114 s("Pu","",244);
115 s("Am","",243);
116 s("Cm","",247);
117 s("Bk","",247);
118 s("Cf","",251);
119 s("Es","",252);
120 s("Fm","",257);
121 s("Md","",258);
122 s("No","",259);
123 s("Lr","",262);
124 s("Rf","",267);
125 s("Db","",268);
126 s("Sg","",269);
127 s("Bh","",270);
128 s("Hs","",269);
129 s("Mt","",277);
130 s("Ds","",281);
131 s("Rn","",282);
132 s("Cn","",285);
133 s("Nh","",286);
134 s("Fl","",290);
135 s("Mc","",290);
136 s("Lv","",293);
137 s("Ts","",294);
138 s("Og","",294);
139 if(argc<=1
140 || (argc>1
141 && (argv[1]=="--"
142 || argv[1]=="-"))) // read from stdin
144 cout<<"plz input formula as parameter.\n";
145 return 0;
148 return 0;