单选题:下面有一个结构体,对结构体的错误使用是( )
下面有一个结构体,对结构体的错误使用是( )
c++
struct Book{
string name;
double price;
}
A.c++
Book b;
b={"C++",20};
B.c++
Book b={20,"C++"};
C.
Book *b=new Book[2];
b[0].name="C++";
b[0].price=20;
D.
Book *p=new Book();
p->name="C++";
p->price=20;
answer:B
c++
struct Book{
string name;
double price;
}
A.c++
Book b;
b={"C++",20};
B.c++
Book b={20,"C++"};
C.
Book *b=new Book[2];
b[0].name="C++";
b[0].price=20;
D.
Book *p=new Book();
p->name="C++";
p->price=20;
answer:B