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:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
|
#include <iostream>
#include <string>
using namespace std;
char *slim_slut = "Uhm, how about chocolate?";
char *norm_slut = "Ok well... you feel to fad, right?";
char *fat_slut = "You are too fad slut!";
char *slim_guy = "maybe you should eat something";
char *norm_guy = "you are perfectly normal";
char *fat_guy = "beer, chips and couch-fishing";
typedef void (*VP)();
VP sexfp[256];
VP massfp[2];
VP heightfp[2];
char *str_m[256];
char *str_f[256];
double m;
double h;
void sex();
void sex_m();
void sex_f();
void sex_init();
void mass();
void mass_init();
void height();
void height_init();
void strings_init();
void init();
void sex()
{
unsigned char c;
cout << "Sex (m/f): ";
cin >> c;
sexfp[c]();
}
void sex_m()
{
double bmi = m / ((h/100)*(h/100));
cout << "BMI: " << bmi << endl;
cout << str_m[(unsigned char)bmi] << endl;
exit(0);
}
void sex_f()
{
double bmi = m / ((h/100)*(h/100));
cout << "BMI: " << bmi << endl;
cout << str_f[(unsigned char)bmi] << endl;
exit(0);
}
void sex_init()
{
sexfp[0] = &sex;
sexfp[1] = &sex;
memcpy(&sexfp[2], sexfp, sizeof(VP) * 2);
memcpy(&sexfp[4], sexfp, sizeof(VP) * 4);
memcpy(&sexfp[8], sexfp, sizeof(VP) * 8);
memcpy(&sexfp[16], sexfp, sizeof(VP) * 16);
memcpy(&sexfp[32], sexfp, sizeof(VP) * 32);
memcpy(&sexfp[64], sexfp, sizeof(VP) * 64);
memcpy(&sexfp[128], sexfp, sizeof(VP) * 128);
sexfp['m'] = &sex_m;
sexfp['f'] = &sex_f;
}
void mass()
{
int f;
cout << "Mass: " << flush;
cin >> m;
f = (int)cin.good();
cin.clear();
cin.ignore();
massfp[f]();
}
void mass_init()
{
massfp[0] = &mass;
massfp[1] = &height;
}
void height()
{
int f;
cout << "Height: " << flush;
cin >> h;
f = (int)cin.good();
cin.clear();
cin.ignore();
heightfp[f]();
}
void height_init()
{
heightfp[0] = &height;
heightfp[1] = &sex;
}
void strings_init()
{
str_m[0] = fat_guy;
str_m[1] = fat_guy;
memcpy(&str_m[2], str_m, sizeof(VP) * 2);
memcpy(&str_m[4], str_m, sizeof(VP) * 4);
memcpy(&str_m[8], str_m, sizeof(VP) * 8);
memcpy(&str_m[16], str_m, sizeof(VP) * 16);
memcpy(&str_m[32], str_m, sizeof(VP) * 32);
memcpy(&str_m[64], str_m, sizeof(VP) * 64);
memcpy(&str_m[128], str_m, sizeof(VP) * 128);
str_m[20] = norm_guy;
str_m[21] = norm_guy;
memcpy(&str_m[22], &str_m[20], sizeof(VP) * 2);
memcpy(&str_m[24], &str_m[20], sizeof(VP) * 2);
str_m[0] = slim_guy;
str_m[1] = slim_guy;
memcpy(&str_m[2], str_m, sizeof(VP) * 2);
memcpy(&str_m[4], str_m, sizeof(VP) * 4);
memcpy(&str_m[8], str_m, sizeof(VP) * 8);
memcpy(&str_m[16], str_m, sizeof(VP) * 4);
str_f[0] = fat_slut;
str_f[1] = fat_slut;
memcpy(&str_f[2], str_f, sizeof(VP) * 2);
memcpy(&str_f[4], str_f, sizeof(VP) * 4);
memcpy(&str_f[8], str_f, sizeof(VP) * 8);
memcpy(&str_f[16], str_f, sizeof(VP) * 16);
memcpy(&str_f[32], str_f, sizeof(VP) * 32);
memcpy(&str_f[64], str_f, sizeof(VP) * 64);
memcpy(&str_f[128], str_f, sizeof(VP) * 128);
str_f[20] = norm_slut;
str_f[21] = norm_slut;
memcpy(&str_f[22], &str_f[20], sizeof(VP) * 2);
memcpy(&str_f[24], &str_f[20], sizeof(VP) * 2);
str_f[0] = slim_slut;
str_f[1] = slim_slut;
memcpy(&str_f[2], str_f, sizeof(VP) * 2);
memcpy(&str_f[4], str_f, sizeof(VP) * 4);
memcpy(&str_f[8], str_f, sizeof(VP) * 8);
memcpy(&str_f[16], str_f, sizeof(VP) * 4);
}
void init()
{
mass_init();
height_init();
sex_init();
strings_init();
}
int main(int argc, char **argv)
{
cout << "Evil BMI(TM) by Hanfling" << endl;
init();
mass();
return 0;
}
|