Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // main.cpp
- // Family Tree Creator
- //
- //
- #include <iostream>
- #include <algorithm>
- #include <vector>
- class Person{
- std::string firstName, lastName;
- int birthDay, birthMonth, birthYear;
- int deathDay, deathMonth, deathYear;
- public:
- //Constructor
- Person(std::string fn = "Empty", std::string ln = "Empty", int bd = 14, int bm = 4, int by = 2016, int dd = 14, int dm = 4, int dy = 2016){
- firstName = fn;
- lastName = ln;
- birthDay = bd;
- birthMonth = bm;
- birthYear = by;
- deathDay = dd;
- deathMonth = dm;
- deathYear = dy;
- }
- //Destructor
- ~Person();
- void enterPerson(){
- std::cout << "Enter first name of person: ";
- std::cin >> firstName;
- std::cout << "Enter last name of person: ";
- std::cin >> lastName;
- std::cout << "Enter day, month and year of birth (separated by a space): ";
- std::cin >> birthDay >> birthMonth >> birthYear;
- std::cout << "Enter day, month and year of death (separated by a space): ";
- std::cin >> deathDay >> deathMonth >> deathYear;
- }
- void showPerson(){
- std::cout << "Person first and last name: ";
- std::cout << firstName << " " << lastName << std::endl;
- std::cout << "Birth: " << birthDay << "." << birthMonth << "." << birthYear << std::endl;
- std::cout << "Death: " << deathDay << "." << deathMonth << "." << deathYear << std::endl;
- }
- };
- int main() {
- std::cout << "How much persons?: ";
- int howMuch;
- std::cin >> howMuch;
- Person *tab = new Person[howMuch];
- tab -> enterPerson();
- delete [] tab;
- return 0;
- }
Add Comment
Please, Sign In to add comment