考生信息管理(结构struct简单应用)-c#编程小实例

济南网站建设 2022年12月18日06:22:52C#教程考生信息管理(结构struct简单应用)-c#编程小实例已关闭评论217阅读模式

【考生信息管理(结构struct简单应用)】

关键代码:

namespace 结构1
{

public struct Student
{
public string Name;
public int Age;
public string Gender;
public string Major;
public string Mddress;

}
internal class Program
{

static void Main(string[] args)
{

 

Student zs = new Student();
zs.Name = "张三";
zs.Age = 20;
zs.Gender = "男";
zs.Major = "软件开发";
zs.Mddress = "山东";

Student ls= new Student();
ls.Name = "李四";
ls.Age = 20;
ls.Gender = "男";
ls.Major = "网络工程";
ls.Mddress = "济南";

Student ww = new Student();
ww.Name = "王五";
ww.Age = 19;
ww.Gender = "女";
ww.Major = "通信工程";
ww.Mddress = "青岛";

Student zl = new Student();
zl.Name = "赵六";
zl.Age = 19;
zl.Gender = "女";
zl.Major = "网络安全";
zl.Mddress = "泰安";

Student cq = new Student();
cq.Name = "陈七";
cq.Age = 21;
cq.Gender = "女";
cq.Major = "大数据";
cq.Mddress = "烟台";

Student lj = new Student();
lj.Name = "刘九";
lj.Age = 18;
lj.Gender = "女";
lj.Major = "计算机应用";
lj.Mddress = "济宁";

Console.WriteLine("学生姓名:{0},性别:{1},年龄:{2},专业:{3},家庭住址:{4}.", zs.Name,zs.Gender,zs.Age,zs.Major,zs.Mddress);
Console.WriteLine("学生姓名:{0},性别:{1},年龄:{2},专业:{3},家庭住址:{4}.", ls.Name, ls.Gender, ls.Age, ls.Major, ls.Mddress);
Console.WriteLine("学生姓名:{0},性别:{1},年龄:{2},专业:{3},家庭住址:{4}.", ww.Name, ww.Gender, ww.Age, ww.Major, ww.Mddress);
Console.WriteLine("学生姓名:{0},性别:{1},年龄:{2},专业:{3},家庭住址:{4}.", zl.Name, zl.Gender, zl.Age, zl.Major, zl.Mddress);
Console.WriteLine("学生姓名:{0},性别:{1},年龄:{2},专业:{3},家庭住址:{4}.", cq.Name, cq.Gender, cq.Age, cq.Major, cq.Mddress);
Console.WriteLine("学生姓名:{0},性别:{1},年龄:{2},专业:{3},家庭住址:{4}.", lj.Name, lj.Gender, lj.Age, lj.Major, lj.Mddress);
Console.ReadKey();

}
}
}

济南网站建设
  • 本文由 发表于 2022年12月18日06:22:52
  • 转载请务必保留本文链接:http://news.hcsw666.com/457