#include <string>
#include <sstream>
#include <iostream>
class Person {
std::string ID;
std::string name;
std::string address;
std::string phone;
public:
Person(std::string ID0, std::string name0, std::string address0, std::string phone0)
: ID(ID0), name(name0), address(address0), phone(phone0) {}
Person() {}
void show() const {
std::cout << "Person created with ID " << ID << " and phone " << phone << '\n';
}
friend std::istream& operator>>(std::istream& is, Person& p)
{
getline(is, p.ID);
getline(is, p.name);
getline(is, p.address);
getline(is, p.phone);
return is;
};
};
int main()
{
std::istringstream test("529173860\n"
"Dick B. Smith\n"
"879 Maple Road, Centralia, Colorado 24222\n"
"(312) 000-1000\n"
"925173870\n"
"Harry C. Anderson\n"
"635 Main Drive, Midville, California 48444\n"
"(660) 050-2200");
Person p;
while(test >> p)
{
p.show();
}
}
I2luY2x1ZGUgPHN0cmluZz4KI2luY2x1ZGUgPHNzdHJlYW0+CiNpbmNsdWRlIDxpb3N0cmVhbT4KY2xhc3MgUGVyc29uIHsKICAgIHN0ZDo6c3RyaW5nIElEOwogICAgc3RkOjpzdHJpbmcgbmFtZTsKICAgIHN0ZDo6c3RyaW5nIGFkZHJlc3M7CiAgICBzdGQ6OnN0cmluZyBwaG9uZTsKcHVibGljOgogICAgICAgIFBlcnNvbihzdGQ6OnN0cmluZyBJRDAsIHN0ZDo6c3RyaW5nIG5hbWUwLCBzdGQ6OnN0cmluZyBhZGRyZXNzMCwgc3RkOjpzdHJpbmcgcGhvbmUwKQogICAgOiBJRChJRDApLCBuYW1lKG5hbWUwKSwgYWRkcmVzcyhhZGRyZXNzMCksIHBob25lKHBob25lMCkge30KICAgIFBlcnNvbigpIHt9CgogICAgdm9pZCBzaG93KCkgY29uc3QgewogICAgICAgICAgICBzdGQ6OmNvdXQgPDwgIlBlcnNvbiBjcmVhdGVkIHdpdGggSUQgIiA8PCBJRCA8PCAiIGFuZCBwaG9uZSAiIDw8IHBob25lIDw8ICdcbic7CiAgICB9CgpmcmllbmQgc3RkOjppc3RyZWFtJiBvcGVyYXRvcj4+KHN0ZDo6aXN0cmVhbSYgaXMsIFBlcnNvbiYgcCkgCiAgICB7CiAgICAgICAgZ2V0bGluZShpcywgcC5JRCk7CiAgICAgICAgZ2V0bGluZShpcywgcC5uYW1lKTsKICAgICAgICBnZXRsaW5lKGlzLCBwLmFkZHJlc3MpOwogICAgICAgIGdldGxpbmUoaXMsIHAucGhvbmUpOwogICAgICAgIHJldHVybiBpczsKICAgIH07Cn07CgppbnQgbWFpbigpCnsKICAgIHN0ZDo6aXN0cmluZ3N0cmVhbSB0ZXN0KCI1MjkxNzM4NjBcbiIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICJEaWNrIEIuIFNtaXRoXG4iCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAiODc5IE1hcGxlIFJvYWQsIENlbnRyYWxpYSwgQ29sb3JhZG8gMjQyMjJcbiIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICIoMzEyKSAwMDAtMTAwMFxuIgogICAgICAgICAgICAgICAgICAgICAgICAgICAgIjkyNTE3Mzg3MFxuIgogICAgICAgICAgICAgICAgICAgICAgICAgICAgIkhhcnJ5IEMuIEFuZGVyc29uXG4iCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAiNjM1IE1haW4gRHJpdmUsIE1pZHZpbGxlLCBDYWxpZm9ybmlhIDQ4NDQ0XG4iCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAiKDY2MCkgMDUwLTIyMDAiKTsKICAgIFBlcnNvbiBwOwogICAgd2hpbGUodGVzdCA+PiBwKQogICAgewogICAgICAgIHAuc2hvdygpOwogICAgfQp9Cg==