C#简单的枚举及结构
程序员文章站
2022-04-29 13:53:07
using System; namespace program { enum WeekDays { a,//0 b,//1 c = 11,//11 赋值以后就变成11,不赋值就是2 d,//12 e,//13 f,//14 g//15 }//不能输入数字 struct student { publi ......
using system; namespace program { enum weekdays { a,//0 b,//1 c = 11,//11 赋值以后就变成11,不赋值就是2 d,//12 e,//13 f,//14 g//15 }//不能输入数字 struct student { public string name; public char sex; public int age; } class program1 { static void main(string[] args) { weekdays letter; letter = weekdays.e; for (letter = 0; letter < weekdays.g; letter++) { console.writeline(letter);//看看枚举里的值到底是多少 } student bruce;//结构体的运用 bruce.age = 18; bruce.name = "布鲁斯"; bruce.sex = '男'; student talyo; talyo.age = 19; talyo.name = "泰勒"; talyo.sex = '女'; console.writeline("姓名:{0}",bruce.name); console.writeline("年龄:{0}",bruce.age); console.writeline("性别:{0}",bruce.sex); console.writeline("姓名:{0}",talyo.name); console.writeline("年龄:{0}", talyo.age); console.writeline("性别:{0}", talyo.sex); } } }
上一篇: SQLITE源码剖析(9)
下一篇: ret/retn人为改变执行地址