public static void Main(string[] args) { //Student Database person[] database = new person[150]; //Student's position in the database int studentStatus = 0; //Condition for the program to stay running bool maineMenu_isalive = true; //Main menu while (maineMenu_isalive) { try { int select = Convert.ToInt32(menu()); switch (select) { case 1: //Add student { Console.Clear(); person adds = addStudent(); database[studentStatus] = adds; studentStatus++; Console.ReadKey(); break; } case 2: //Show student int numberStudent = 0; //The number opposite the name in the list { if (database[0] == null) { Console.WriteLine("\nNo information was entered from the students"); Console.ReadKey(); } else { Console.Clear(); foreach (person student in database) { numberStudent = numberStudent + 1; Console.WriteLine(numberStudent + ") full name : " + student.name + " " + student.family); } Console.ReadKey(); } break; } case 3: //exit { Console.Clear(); maineMenu_isalive = false; break; } default: //Wrong option { Console.Clear(); Console.WriteLine("The entered option is incorrect"); Console.ReadKey(); break; } } } catch (NullReferenceException) { Console.WriteLine("\npleas enter number of student : "); int studentSelection = showStdOption(); bool showStdOption_isaliv = true; while (showStdOption_isaliv) { try { person selectedSudent = database[studentSelection]; Console.Clear(); Console.WriteLine("name: " + selectedSudent.name + "\nfamily: " + selectedSudent.family + "\nage: " + selectedSudent.age + "\naverage: " + selectedSudent.average); showStdOption_isaliv = false; Console.ReadKey(); } catch { Console.WriteLine("\nEnter only the number in front of the student's name"); Console.ReadKey(); showStdOption_isaliv = false; } } } catch { Console.WriteLine("The entered option is incorrect"); Console.ReadKey(); } } }