15. 结构体

创建日期:2024-07-11
更新日期:2025-02-01

structur.cpp

#include <iostream>

struct inflatable
{
    char name[20];
    float volume;
    double price;
};

int main()
{
    using namespace std;
    inflatable guest = {
        "Glorious Gloria",
        1.88,
        29.99};
    inflatable pal = {
        "Audancious Arthur",
        3.12,
        32.99};

    cout << "Expand your guest list with " << guest.name;
    cout << " and " << pal.name << "!\n";
    cout << "You can have both for $";
    cout << guest.price + pal.price << "!\n";
}