-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPet.cpp
More file actions
42 lines (38 loc) · 843 Bytes
/
Pet.cpp
File metadata and controls
42 lines (38 loc) · 843 Bytes
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
#include <iostream>
#include <string>
#include <locale>
using namespace std;
class Pet {
private:
string name;
string animal_type;
int age;
public:
void set_name(string pet_name) {
name = pet_name;
}
string get_name() {
return name;
}
void set_animal_type(string type) {
animal_type = type;
}
string get_animal_type() {
return animal_type;
}
void set_age(int pet_age) {
age = pet_age;
}
int get_age() {
return age;
}
};
int main() {
setlocale(LC_ALL, "RUS");
Pet my_pet;
my_pet.set_name("Áàðñèê");
my_pet.set_animal_type("Êîò");
my_pet.set_age(5);
cout << my_pet.get_name() << " " << my_pet.get_age() << " ëåò " << my_pet.get_animal_type() << endl;
return 0;
}