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