马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
#include<iostream>
#include<string>
using namespace std;
struct inflatable
{
char name[20];
float volume;
double price;
};
int main()
{
inflatable guest[3]=
{
{"Bambi",0.5,21.99},
{"Godzilla",2000,565.99}
};
guest[2]={"Car",1000,100000};
cout<<"The guest "<<guest[0].name<<" and "<<guest[1].name
<<"\nhave a combined volume of"
<<guest[0].volume+guest[1].volume<<" cubic feet.\n";
return 0;
}
我给guest[2]赋值后就报错了error: no match for 'operator=' (operand types are 'inflatable' and '<brace-enclosed initializer list>')|
char字符串不能直接用 = 号来赋值,c++还是用string吧
|