include string include iostream include cstdlib using namespace std en

 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
#include <string>
#include <iostream>
#include <cstdlib>
using namespace std;
enum eWingsColorType {
PIGMENTARY, OPTICAL, COMBINATIONAL
};
enum eTransformationState {
EGG, LARVA, SHRYSALIS, IMAGO
};
enum eGender {
MALE, FEMALE
};
class Batterfly {
string wingsColor; //окраска крыльев
float wingsSpan; //размах крыла
eWingsColorType wingsColorType; //тип окраски крыльев
eTransformationState transformationState; //стадия развития
eGender gender; //пол
public:
Batterfly(string aWingsColor, float aWingsSpan) {
wingsColor = aWingsColor;
wingsSpan = aWingsSpan < 28 ? aWingsSpan : 28;
transformationState = EGG;
wingsColorType = (eWingsColorType) (rand() % 4);
gender = (eGender) (rand() % 2);
}
Batterfly(string aWingsColor, float aWingsSpan, eWingsColorType aWingsColorType, eGender aGender) {
wingsColor = aWingsColor;
wingsSpan = aWingsSpan < 28 ? aWingsSpan : 28;
wingsColorType = aWingsColorType;
gender = aGender;
}
~Batterfly() {
cout << endl << "I am dead:(";
}
eWingsColorType getWingsColorType() const {
return wingsColorType;
}
eGender getGender() const {
return gender;
}
eTransformationState getTransformationState() const {
return transformationState;
}
string getWingsColor() const {
return wingsColor;
}
float getWingsSpan() const {
return wingsSpan;
}
bool nextTransformationStep() {
if (transformationState != IMAGO) {
transformationState = (eTransformationState) (((int) transformationState) + 1);
return true;
} else return false; //дальше развиваться некуда
}
void fly(long seconds) {
//...
};
};
/*
*
*/
int main(int argc, char** argv) {
Batterfly b("red", 12.3);
cout << b.getWingsColor();
return 0;
}