#include <fmt/core.h>
#include <chrono>
#include <thread>
#include <string>
struct SimplePerson {
std::string name;
int age{1};
int pets{_guess_pets(age)};
bool alive{true};
std::string how_alive() {
return alive ? "very alive" : "very dead";
}
void print() {
fmt::println("I am {} and I am {} years old. I have {} pets and I am {}.",
name, age, pets, how_alive());
}
private:
int _guess_pets(int age) {
return age / 10 + 1;
}
};
int main(int argc, char* argv[]) {
// try doing the initialize like before to see the error
SimplePerson baby{.name="Baby", .pets=0};
baby.print();
SimplePerson zed{.name="Zed", .age=51};
zed.print();
SimplePerson mary{.name="Mary", .age=28, .pets=1};
mary.print();
SimplePerson zombie{.name="Zombie", .age=100, .alive=false};
zombie.print();
}