struct choice{
CString choicename;
struct link *choiceitem;
struct choice *next;
};
struct link{
CString choiceitems;
struct link *next;
};
choice yourchoice[4];
yourchoice[0].choicename="平时政治表现";
yourchoice[1].choicename="参加集体活动";
yourchoice[2].choicename="课外钻研能力";
yourchoice[3].choicename="人际组织能力";
link yourlink[4];
yourlink[0].choiceitems="好,良好,优秀,差";
yourlink[1].choiceitems="积极,较积极,不积极";
yourlink[2].choiceitems="强,较强,不强";
yourlink[3].choiceitems="突出,一般,差";
yourchoice[0]->choiceitem=&yourlink[0];//此处报错
CString choicename;
struct link *choiceitem;
struct choice *next;
};
struct link{
CString choiceitems;
struct link *next;
};
choice yourchoice[4];
yourchoice[0].choicename="平时政治表现";
yourchoice[1].choicename="参加集体活动";
yourchoice[2].choicename="课外钻研能力";
yourchoice[3].choicename="人际组织能力";
link yourlink[4];
yourlink[0].choiceitems="好,良好,优秀,差";
yourlink[1].choiceitems="积极,较积极,不积极";
yourlink[2].choiceitems="强,较强,不强";
yourlink[3].choiceitems="突出,一般,差";
yourchoice[0]->choiceitem=&yourlink[0];//此处报错
改成:
yourchoice[0].choiceitem=&yourlink[0];->前面应该是指针
yourchoice[0].choiceitem=&yourlink[0];//此处报错
yourchoice[0].choiceitem=&yourlink[0]
error C2440: '=' : cannot convert from 'struct CChoice::OnSelchangeList1::link *' to 'struct link *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
就像你前面引用它的choicename成员一样,也要用 .
yourchoice[0].choicename="平时政治表现";
CString choicename;
struct link *choiceitem; //改成link *choiceitem; 试试
struct choice *next;
};
struct link{
CString choiceitems;
struct link *next;
};
choice yourchoice[4];
yourchoice[0].choicename="平时政治表现";
yourchoice[1].choicename="参加集体活动";
yourchoice[2].choicename="课外钻研能力";
yourchoice[3].choicename="人际组织能力";
link yourlink[4];
yourlink[0].choiceitems="好,良好,优秀,差";
yourlink[1].choiceitems="积极,较积极,不积极";
yourlink[2].choiceitems="强,较强,不强";
yourlink[3].choiceitems="突出,一般,差";
yourchoice[0]->choiceitem=&yourlink[0];//此处报错。
//改成yourchoice[0].choiceitem=&yourlink[0];//此处报错
比如说对于yourchoice[2].choicename="课外钻研能力";如何取得yourlink[2].choiceitems="强,较强,不强";这个值
yourchoice[3].choiceitem
yourchoice[0].choiceitem->choiceitems你的定义和赋值好乱阿
昏
没错吧
语法上没错吧
建议用字符数组分别存放,你这样做不容易取值的。
zzitem[0]='好';
zzitem[1]='良好';
zzitem[2]='优秀';
zzitem[3]='差';
这样行吗?如何加入
是字符串数组
CString zzitem[4];
那些 ' 改成 " listbox的用法
msdn上有
或者你在版上搜一下,很多的
zzitem[0]="好";
zzitem[1]="良好";
zzitem[2]="优秀";
zzitem[3]="差";
然后yourlink[0].choiceitems=&zzitem[0];为什么错?
CString choiceitems;
struct link *next;
中choiceitem是数组,用来存放菜单的子项,如何在点击一个菜单时将其子项全部显示在listbox中?