blob: 93223f31e76e8338dabe0bd57520a3b324f64e22 (
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
30
|
#ifndef PERSON_H
#define PERSON_H
#include <string>
#include <vector>
#include <iostream>
struct Person {
Person() = default;
explicit 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
|