//下限0,上限2; enum sex{male=1,female=0}; struct person{ string name; sex sex; }; int main(){ person leaves={"叶知泉",male}; cout<<leaves.name<<endl; cout<<leaves.sex<<endl; //不初始值 person leaves2; leaves2.name="小叶子"; cout<<leaves2.name<<endl; cout<<leaves2.sex<<endl; //new创建 person * leaves3=new person; leaves3->name="大叶子"; cout<<leaves3->name<<endl; cout<<leaves3->sex<<endl; delete leaves3; system("pause"); return 0; }