#includestdioh #includemathh #includestringh enum SEX GIRL BOY ; struct SStudent char num15; 学号 char name20; 姓名 enum SEX sex; 性别 ; struct SStudentEx struct SStudent base; char Phone20; ; int main i
因为性别是枚举类型,它的取值只能是枚举值中的一个,而不是任意的字符串或数字。因此在输入时需要用取址符&来获取其地址,以便将输入的字符串转换为相应的枚举值。其他的变量如char数组等都可以直接获取其地址。
原文地址: https://www.cveoy.top/t/topic/dT2s 著作权归作者所有。请勿转载和采集!