static void Main(string[] args) { StudentManger sm = new StudentManger("admin", "123456"); sm.AddStudent(new Student(1001, "zhang san", 85)); sm.AddStudent(new Student(1002, "li si", 95)); sm.AddStudent(new Student(1003, "lao si", 75)); sm.AddStudent(new Student(1004, "zhao wu", 65)); sm.AddStudent(new Student(1005, "lao wang", 93)); Student s = sm.FindStudentById(1003); Console.WriteLine("该生的学号是{0},姓名是{1},分数是{2}", s.Id, s.Name, s.Grade); sm.UpdateStudent(1003, "lao peng"); Student s1 = sm.FindStudentById(1003); Console.WriteLine("该生的学号是{0},姓名是{1},分数是{2}", s1.Id, s1.Name, s1.Grade); bool b = sm.DeleteStudentById(1004); Console.WriteLine(b); Student[] ss = new Student[sm.list.Count]; for (int i = 0; i < sm.list.Count; i++) { ss[i] = (Student)sm.list[i]; } for (int i = 0; i < ss.Length; i++) { Console.WriteLine(ss[i].Id); } sm.SortStudent(); Console.ReadKey(); }
public static void Update() { Console.WriteLine("请输入需要修改学生的编号及修改内容"); string s = Console.ReadLine(); string[] ss = s.Split(','); int n = Convert.ToInt32(ss[0]); string name = ss[1]; manage.UpdateStudent(n, name); Console.WriteLine("修改成功"); }