blob: 29d0150fdfd4a7f7cb4c250b4233df3964a76b8f (
plain)
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
|
#ifndef PERSON_H
#define PERSON_H
#include <string>
#include <vector>
struct Person {
Person() = default;
Person(const std::string &name): Name(name) {}
Person(const std::string &name, const std::string &addr): Name(name), Address(addr) {}
std::string Name;
std::string Address;
std::string GetAddress() const { return Address; }
std::string GetName() const { return Name; }
};
std::istream &read(std::istream &pcin, Person &p1) {
std::getline(pcin, p1.Name);
std::getline(pcin, p1.Address);
return pcin;
}
std::ostream &print(std::ostream &pcout, const Person &p1) {
pcout << p1.GetName() << "\n" << p1.GetAddress();
return pcout;
}
#endif
|