static void Main() { StudentSystem studentSystem = new StudentSystem(); string input; while ((input = Console.ReadLine()) != "Exit") { string[] args = input.Split(); string command = args[0]; string name = args[1]; switch (command) { case "Create": var age = int.Parse(args[2]); var grade = double.Parse(args[3]); studentSystem.CreateStudent(name, age, grade); break; case "Show": Console.WriteLine(studentSystem.StudentInfo(name)); break; } } }
static void Main() { StudentSystem studentSystem = new StudentSystem(); while (true) { string[] commands = Console.ReadLine().Split(); if (commands[0] == "Exit") { studentSystem.Exit(); } string studentName = commands[1]; if (commands[0] == "Create") { int studentAge = int.Parse(commands[2]); double studentAverage = double.Parse(commands[3]); Student currentStudent = new Student(studentName, studentAge, studentAverage); studentSystem.CreateStudent(currentStudent); } try { if (commands[0] == "Show") { Console.WriteLine(studentSystem.ShowStudent(studentName)); } } catch (Exception) { continue; } } }