结构数组的简单运用
程序员文章站
2022-07-15 08:36:27
...
#include <iostream>
#include <string>
struct inflatable {
std::string name;
float volume;
double price;
};
int main() {
using namespace std;
inflatable guest[2]{
{"Bambi",0.5,21.99},
{"Godzilla", 2000, 565.99}
};
cout << "the guests " << guest[0].name << " and " << guest[1].name
<< "\nhave a combined volume of " << guest[0].volume + guest[1].volume << " cubic feet.\n";
return 0;
}
上一篇: 数组api简单运用
下一篇: js语句的简单运用编程基础