left of '.last_clname' must have class/struct/union typeclass Catalog{public:char last_clname[10];char catalog_name[10];int fileamount;int catalogamount;string filename[10];string catalogname[10];};void Creatcatalog(){class Catalog{};char cln

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/07 06:47:41

left of '.last_clname' must have class/struct/union typeclass Catalog{public:char last_clname[10];char catalog_name[10];int fileamount;int catalogamount;string filename[10];string catalogname[10];};void Creatcatalog(){class Catalog{};char cln
left of '.last_clname' must have class/struct/union type
class Catalog{
public:
char last_clname[10];
char catalog_name[10];
int fileamount;
int catalogamount;
string filename[10];
string catalogname[10];
};
void Creatcatalog()
{
class Catalog{};
char clname[10];
coutclname[10];
Catalog *catalog=new Catalog();
catalog.last_clname=123;//此为错误行,
}

left of '.last_clname' must have class/struct/union typeclass Catalog{public:char last_clname[10];char catalog_name[10];int fileamount;int catalogamount;string filename[10];string catalogname[10];};void Creatcatalog(){class Catalog{};char cln
错误很多,你这是找错吗?
void Creatcatalog()
{
class Catalog{};//错了,这样表示声明了一个内类
char clname[10];
coutclname[10]; //改成 cin>>clname;可能会更好
Catalog *catalog=new Catalog();
catalog.last_clname=123;//此为错误行,//创建的是指针,所以只能catalog->last_clname,而且这是个char[],所以不能直接赋值catalog->last_clname="abc",就是错的,可以使用memcpy赋值
}