-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPhone.cpp
More file actions
58 lines (45 loc) · 1.16 KB
/
Phone.cpp
File metadata and controls
58 lines (45 loc) · 1.16 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
#include <iostream>
#include <string>
#include <locale>
using namespace std;
class Phone {
private:
string number;
string model;
double weight;
public:
Phone(string num, string mod, double wt) {
number = num;
model = mod;
weight = wt;
}
Phone(string num, string mod) {
number = num;
model = mod;
weight = 0.0;
}
Phone() {
number = "";
model = "";
weight = 0.0;
}
void receiveCall(string callerName) {
cout << "Âõîäÿùèé çâîíîê îò " << callerName << endl;
}
string getNumber() {
return number;
}
};
int main() {
setlocale(LC_ALL, "RUS");
Phone phone1("+79306825281", "Xiaomi Note 11T Pro", 0.2);
Phone phone2("+79100572071", "Samsung Galaxy S21");
Phone phone3;
phone1.receiveCall("Ìàìà");
cout << "Íîìåð òåëåôîíà: " << phone1.getNumber() << endl;
phone2.receiveCall("Ïàïà");
cout << "Íîìåð òåëåôîíà: " << phone2.getNumber() << endl;
phone3.receiveCall("Áàáóøêà");
cout << "Íîìåð òåëåôîíà: " << phone3.getNumber() << endl;
return 0;
}