-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReaders.cpp
More file actions
89 lines (68 loc) · 2.09 KB
/
Readers.cpp
File metadata and controls
89 lines (68 loc) · 2.09 KB
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 <iostream>
#include <string>
using namespace std;
class Reader {
private:
string firstName;
string lastName;
int readerTicketNumber;
string faculty;
string birthDate;
string phoneNumber;
public:
Reader(string firstName, string lastName, int readerTicketNumber, string faculty, string birthDate, string phoneNumber) : firstName(firstName), lastName(lastName), readerTicketNumber(readerTicketNumber), faculty(faculty), birthDate(birthDate), phoneNumber(phoneNumber) {}
void takeBook() {
cout << "Читатель " << firstName << " " << lastName << " взял книгу" << endl;
}
void returnBook() {
cout << "Читатель " << firstName << " " << lastName << " вернул книгу" << endl;
}
string getFirstName() {
return firstName;
}
string getLastName() {
return lastName;
}
int getReaderTicketNumber() {
return readerTicketNumber;
}
string getFaculty() {
return faculty;
}
string getBirthDate() {
return birthDate;
}
string getPhoneNumber() {
return phoneNumber;
}
};
class Book {
private:
string author;
string title;
int year;
public:
Book(string author, string title, int year) : author(author), title(title), year(year) {}
string getAuthor() {
return author;
}
string getTitle() {
return title;
}
int getYear() {
return year;
}
};
int main() {
setlocale(LC_ALL, "RU");
system("chcp 1251");
Reader reader1("Иван", "Иванов", 1234, "Факультет математики", "01-01-2001", "+79123456789");
Reader reader2("Петр", "Петров", 5678, "Факультет физики", "02-02-2002", "+79234567890");
Book book1("Автор1", "Название1", 2022);
Book book2("Автор2", "Название2", 2023);
reader1.takeBook();
reader2.takeBook();
reader1.returnBook();
reader2.returnBook();
return 0;
}