#include <print>
#include <string>
#include <string_view>

// Klasse zum Abspeichern und Formatierung eines Datums
struct Date
{
    unsigned char day;
    unsigned char month;
    unsigned short year;
    // Liefert das Datum als string zurueck
    std::string Print() const
    {
        return std::format("{:02}.{:02}.{}", day, month, year);
    }
};

// Komponisten-Klasse
class Composer
{
    std::string name;   // Name des Komponisten
    Date        birth;  // Geburtsdatum
    Date        died;   // Todestag
public:
    // ctor
    Composer (std::string_view _name, const Date& _birth, const Date& _died):
        name(_name), birth(_birth), died(_died)
    {}
    // Ausgabe der Daten
    void Print() const
    {
        std::println("Name: {}, *{}, +{}", name, birth.Print(), died.Print());
    }
};

int main()
{

    // Objektfeld mit den Komponisten
    Composer comp[]{
        {"Johann Sebastian Bach",{31,3,1685},{28,7,1750}},
        {"Wolfgang Amadeus Mozart",{27,1,1756},{5,12,1791}},
        {"Ludwig van Beethoven",{17,12,1770},{26,3,1827}}
    };
    // Ausgabe der Komponisten
    for (auto elem : comp)
        elem.Print();
}
