含有string成员的结构体变量,为什么不能初始化?

struct CatInfo {
 string Title;
 int TotalCnt;
} Cats[2]={{"S01",10},{"S02",10}};

错误:

Compiling...
Yml.cpp
c:/documents and settings/administrator/yml.cpp(10) : error C2440: 'initializing' : cannot convert from 'char [4]' to 'struct CatInfo'
        No constructor could take the source type, or constructor overload resolution was ambiguous
c:/documents and settings/administrator/yml.cpp(10) : error C2440: 'initializing' : cannot convert from 'const int' to 'struct CatInfo'
        No constructor could take the source type, or constructor overload resolution was ambiguous

 

你可能感兴趣的:(C++)