本帖最后由 一点红 于 2013-12-2 10:10 编辑
using System; usingSystem.Collections.Generic; usingSystem.Linq; usingSystem.Text;
namespace 结构体练习 { enum Gender { 男, 女 } publicstruct person { public string name; public Gender sex; publicint age; } class Program { static void Main(string[] args) { persononeperson; oneperson.name = "张三"; oneperson.sex = Gender.男; oneperson.age = 25; Console.WriteLine("请显示他们的信息{0},{1},{2}岁",oneperson.name,oneperson.sex,oneperson.age);
personsecperson; secperson.name = "张燕"; secperson.sex = Gender.女; secperson.age = 22;
Console.WriteLine("请显示他们的信息{0},{1},{3}岁",secperson.name, secperson.sex, secperson.age); Console.ReadKey(); } file:///C:/Users/asus/AppData/Local/Temp/msohtmlclip1/01/clip_image002.jpg
|