#include <iostream>
#include <string>
using namespace std;
class Human {
public:
Human (string name, int day, int month, int year) : name_(move(name)), day_(day), month_(month), year_(year) {}
int age() {
int days = time(0) / (24 * 3600) + 365 * 1970;
return (days - day_ - month_ * 30 - year_* 365) / 365;
}
private:
string name_;
int day_;
int month_;
int year_;
};
int main () {
Human lol("S", 1, 1, 2000);
cout << lol.age();
#include <iostream>
#include <string>
using namespace std;
class Human {
public:
Human (string name, int day, int month, int year) : name_(move(name)), day_(day), month_(month), year_(year) {}
int age() {
int days = time(0) / (24 * 3600) + 365 * 1970;
return (days - day_ - month_ * 30 - year_* 365) / 365;
}
private:
string name_;
int day_;
int month_;
int year_;
};
int main () {
Human lol("S", 1, 1, 2000);
cout << lol.age();
}