fork download
  1. #include <string>
  2. #include <vector>
  3. #include <algorithm>
  4. #include <set>
  5. #include <map>
  6. #include <iostream>
  7.  
  8. using namespace std;
  9.  
  10. class Person {
  11. public:
  12. void ChangeFirstName(int year, const string &first_name) {
  13. year_to_name.emplace_back(year, make_pair(first_name, ""));
  14. }
  15.  
  16. void ChangeLastName(int year, const string &last_name) {
  17. year_to_name.emplace_back(year, make_pair("", last_name));
  18. }
  19.  
  20. string GetFullName(int year) {
  21. }
  22.  
  23. private:
  24. vector<pair<int, pair<string, string>>> year_to_name;
  25. };
  26.  
  27. int main() {
  28. Person person;
  29.  
  30. person.ChangeFirstName(1965, "Polina");
  31. person.ChangeLastName(1967, "Sergeeva");
  32. for (int year : {1900, 1965, 1990}) {
  33. cout << person.GetFullName(year) << endl;
  34. }
  35.  
  36. person.ChangeFirstName(1970, "Appolinaria");
  37. for (int year : {1969, 1970}) {
  38. cout << person.GetFullName(year) << endl;
  39. }
  40.  
  41. person.ChangeLastName(1968, "Volkova");
  42. for (int year : {1969, 1970}) {
  43. cout << person.GetFullName(year) << endl;
  44. }
  45.  
  46. return 0;
  47. }
  48.  
Runtime error #stdin #stdout #stderr 0s 4860KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
double free or corruption (out)