public static string CreateStudent() { String surname = null; int year = 0; int number = 0; SDatabase stbase = new SDatabase(); int n = 0;//counter student string choice = "1"; while (choice == "1") { Console.WriteLine("type surname"); surname = Console.ReadLine(); Console.WriteLine("type study year"); year = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("type student number"); number = Convert.ToInt32(Console.ReadLine()); stbase[n] = new Student(surname, year, number); n = n + 1; Console.WriteLine("For new student type - 1 \t For new aspirant- 2 \t For Students information -3 \t For Aspirant information -4 \t Type -end- to exit"); choice = Console.ReadLine(); } while (choice == "3") { Console.WriteLine("Enter index"); int m = Convert.ToInt32(Console.ReadLine()); stbase[m].Display(); Console.WriteLine("For new student type - 1 \t Type - end - to exit \t For new aspirant- 2 \t For information -3 \t For Students information -4 \t Type -end- to exit "); choice = Console.ReadLine(); } return(choice); }
static void Main(string[] args) { SDatabase stbase = new SDatabase(); AsDatabase astbase = new AsDatabase(); string choice; link1: Console.WriteLine("For new student type - 1"); Console.WriteLine("For new aspirant- 2 "); Console.WriteLine("For information about Students-3"); Console.WriteLine("For information about Aspirants-4"); Console.WriteLine("Type -end- to exit"); choice = Console.ReadLine(); switch (choice) { case "1": CreateStudent(); goto link1; break; case "2": CreateAspirant(); goto link1; break; case "3": CreateStudent(); goto link1; break; case "4": CreateAspirant(); goto link1; break; case "end": break; } Console.ReadKey(); }