Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Students s = new Students();
            s[0] = new Student("张云翼", '男', "电子科大");
            s[1] = new Student("王海", '男', "成都东软");
            s[2] = new Student("陈若水", '女', "电子科大");
            s[3] = new Student("赵霞", '女', "电子科大");
            s[4] = new Student("梅岭", '女', "电子科大");

            PointPerson point = new PointPerson(s.getStudent);
            listBox1.Items.Clear();
            for (int i = 0; i < 5; i++)
            {
                Person a = point(i);
                listBox1.Items.Add("姓名:"+ a.covariant_name+"\t性别:"+ a.covariant_sex);
            }
        }
Beispiel #2
0
 //返回某个人的位置
 public int getPos(Student stu)
 {
     int k = -1;
     for (int i = 0; i < s.Length; i++)
     {
         if (stu.covariant_name == s[i].covariant_name)
         {
             k = i;
             break;
         }
     }
     return k;
 }