-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path15_정답.cpp
79 lines (60 loc) · 1.42 KB
/
15_정답.cpp
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
#include <iostream>
using namespace std;
//손흥민을 축구게임에서 필요한 데이타를 뽑으시고 캡슐화해서 클래스형 데이타 타입을 만들고
// 객체를 생성해서 값을 저장하고 출력해보세요...
class SoccerSon {
private:
string name; // 멤버변수
float weight;
float height;
float speed;
string skill;
public:
string GetName() { // 멤버함수
return name;
}
void SetName(string name) {
name = name;
}
float GetWeight() {
return weight;
}
void SetWeight(float weight) {
weight = weight;
}
float GetHeight() {
return height;
}
void SetHeight(float height) {
height = height;
}
float GetSpeed() {
return speed;
}
void SetSpeed(float speed) {
speed = speed;
}
string GetSkill() {
return skill;
}
void SetSkill(string skill) {
skill = skill;
}
void Info() {
cout << "이름: " << GetName() << endl;
cout << "신장: " << GetHeight() << "cm" << endl;
cout << "몸무게: " << GetWeight() << "Kg" << endl;
cout << "100미터 달리기: " << GetSpeed() << "sec" << endl;
cout << "스킬: " << GetSkill() << endl;
}
};
int main() {
SoccerSon son;
son.SetName("손흥민");
son.SetHeight(182.4f);
son.SetWeight(82.3f);
son.SetSpeed(11.2f);
son.SetSkill("오버헤드킥");
son.Info();
return 0;
}