例题:
/*创建学生结构体,输出最高分数*/
/*使用结构体数组 -----复合类型(string int float等)
student[] students=new student[5];
*/
//定义一个结构体
struct student {
//年龄 前面加了 public是访问修饰符 为所有成员都有访问级别;
public string name;
public int age;
public string sno;
public float score;
//创建一个结构体构造函数
public student(string name1, int age1, string sno1, float score1)
{
this.name = name1;
this.age = age1;
this.sno = sno1;
this.score = score1;
}
}
public void scorehigh()
{
//声明一个结构体数组
student[] stu = new student[5];
//第一种方法 直接new 分配调用构造函数
//stu[0] = new student("Deng",19, "51388938", 90);
//stu[1] =