#include <iostream>
using namespace std;
struct inflatable
{
char name[20];
float volume;
double price;
};
//定義結構
int main()
{
inflatable guest=
{
"Glorious Gloria", //遵循 name[20]
1.88, //遵循 volume
29.99 //遵循 price
};
//guest是inflatable型態結構中的結構變數
inflatable pal=
{
"Audacious 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";
system("pause");
return 0;
}
沒有留言:
張貼留言