static void Main() { ArrayList aspirantlist = new ArrayList(); ArrayList studentlist = new ArrayList(); bool check = true; do { Console.Write("If you wanna register as student press - 1 :\nIf you wanna register as aspirant press - 2 : "); int press12 = TryPress12(); switch (press12) { case 1: { Console.Write("\nInput name of student : "); string name = Alphabet_chechker(); Console.Write("Input surname of student : "); string surname = Alphabet_chechker(); Console.Write("Input course of student : "); int course = TryPress(); Console.Write("Input codebook of student : "); int codebook = TryPress(); Student student = new Student(name, surname, course, codebook); studentlist.Add(student); break; } case 2: { Console.Write("\nInput name of aspirant : "); string name = Alphabet_chechker(); Console.Write("Input surname of aspirant : "); string surname = Alphabet_chechker(); Console.Write("Input course of aspirant : "); int course = TryPress(); Console.Write("Input codebook of aspirant : "); int codebook = TryPress(); Console.Write("Input disertation of aspirant : "); string disertation = Console.ReadLine(); Aspirant aspirant = new Aspirant(name, surname, course, codebook, disertation); aspirantlist.Add(aspirant); break; } } Console.Write("\nFor continue press - 1 :\nFor see all users registered list and exit press - 2 : "); int menu = TryPress12(); switch (menu) { case 1: { check = true; break; } case 2: { check = false; break; } } } while (check == true); foreach (Aspirant each in aspirantlist) { Console.WriteLine("\nYour aspirant : "); Console.ForegroundColor = ConsoleColor.Green; Console.Write("Name of aspirant - " + each.name + ",surname - " + each.surname + ",course - " + each.course + ",codebook - " + each.codebook + ",disertation - " + each.disertation); Console.ResetColor(); } foreach (Student each in studentlist) { Console.WriteLine("\nYour student : "); Console.ForegroundColor = ConsoleColor.Yellow; Console.Write("Name of student - " + each.name + ",surname - " + each.surname + ",course - " + each.course + ",codebook - " + each.codebook); Console.ResetColor(); } Console.Read(); }
static void Main() { bool check = true; do { LinkedList <Student> studentlinked = new LinkedList <Student>(); LinkedList <Aspirant> aspirantlinked = new LinkedList <Aspirant>(); Console.Write("If you wanna register as student press - 1 :\nIf you wanna register as aspirant press - 2 : "); int press12 = TryPress12(); switch (press12) { case 1: { Console.Write("Input name of student : "); string name = Alphabet(); Console.Write("Input surname of student : "); string surname = Alphabet(); Console.Write("Input course of student : "); int course = TryPress(); Console.Write("Input codebook of student : "); int codebook = TryPress(); Student student = new Student(name, surname, course, codebook); studentlinked.AddFirst(student); break; } case 2: { Console.Write("Input name of aspirant : "); string name = Alphabet(); Console.Write("Input surname of aspirant : "); string surname = Alphabet(); Console.Write("Input course of aspirant : "); int course = TryPress(); Console.Write("Input codebook of aspirant : "); int codebook = TryPress(); Console.Write("Input disertation of aspirant : "); string disertation = Console.ReadLine(); Aspirant aspirant = new Aspirant(name, surname, course, codebook, disertation); aspirantlinked.AddFirst(aspirant); break; } } Console.Write("\nFor continue press - 1 \nFor see all users registered list and exit press - 2 : "); int menu = TryPress12(); switch (menu) { case 1: { break; } case 2: { check = false; break; } } foreach (Student st in studentlinked) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("\nName of aspirant - " + st.name + ",surname - " + st.surname + ",course - " + st.course + ",codebook - " + st.name); } foreach (Aspirant asp in aspirantlinked) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("\nName of aspirant - " + asp.name + ",surname - " + asp.surname + ",course - " + asp.course + ",codebook - " + asp.name + ",disertation - " + asp.disertation); } } while (check == true); Console.ResetColor(); Console.Read(); }
static void Main() { bool checki = true; do { Console.Write("If you wanna register as student press - 1 :\nIf you wanna register as aspirant press - 2 : "); int press12 = TryPress12(); switch (press12) { case 1: { Console.Write("Input name of student : "); string name = Alphabet(); Console.Write("Input surname of student : "); string surname = Alphabet(); Console.Write("Input course of student : "); int course = TryPress(); Console.Write("Input codebook of student : "); int codebook = TryPress(); Student student = new Student(name, surname, course, codebook); studentlist.Add(student); break; } case 2: { Console.Write("Input name of aspirant : "); string name = Alphabet(); Console.Write("Input surname of aspirant : "); string surname = Alphabet(); Console.Write("Input course of aspirant : "); int course = TryPress(); Console.Write("Input codebook of aspirant : "); int codebook = TryPress(); Console.Write("Input disertation of aspirant : "); string disertation = Console.ReadLine(); Aspirant aspirant = new Aspirant(name, surname, course, codebook, disertation); aspirantlist.Add(aspirant); break; } } Console.Write("\nFor continue press - 1: \nFor see users registered list press - 2 : "); int menu = TryPress12(); switch (menu) { case 1: { checki = true; break; } case 2: { checki = false; break; } } } while (checki == true); bool check = true; do { Console.WriteLine("\nFor get student with index press 1:\nFor get aspirant with index press 2:\nFor exit and get full list press 3:"); int presskey = TryPress(); switch (presskey) { case 1: { bool checkcase = true; do { Console.Write(" Input index of student : "); int index = TryPress12(); if (index >= studentlist.Count) { Console.WriteLine("\nEmpty list,try again!"); checkcase = true; } else { Student stud = (Student)studentlist[index]; Console.WriteLine("Student name - {0} , surname - {1} , course - {2} , codebook - {3}", stud.name, stud.surname, stud.course, stud.codebook); Console.Write("For continue checking press - 1 , for go to menu - 2 : "); int num = TryPress12(); if (num == 1) { checkcase = true; } else { checkcase = false; } } } while (checkcase == true); break; } case 2: { bool checkcase = true; do { Console.Write("Input index of student : "); int index = TryPress(); if (index >= aspirantlist.Count) { Console.WriteLine("\nEmpty list,try again!"); checkcase = false; } else { Console.ForegroundColor = ConsoleColor.Green; Aspirant asp = (Aspirant)aspirantlist[index]; Console.WriteLine("Student name - {0} , surname - {1} , course - {2} , codebook - {3}", asp.name, asp.surname, asp.course, asp.codebook); Console.ResetColor(); Console.Write("For continue checking press - 1 , for go to menu - 2 : "); int num = TryPress12(); if (num == 1) { checkcase = true; } else { checkcase = false; } } } while (checkcase == true); break; } case 3: { check = false; break; } } } while (check == true); foreach (Aspirant each in aspirantlist) { Console.Write("\n Your aspirant : "); Console.ForegroundColor = ConsoleColor.Yellow; Console.Write("Name of aspirant - " + each.name + ",surname - " + each.surname + ",course - " + each.course + ",codebook - " + each.codebook + ",disertation - " + each.disertation); Console.ResetColor(); } foreach (Student each in studentlist) { Console.Write("\n Your student : "); Console.ForegroundColor = ConsoleColor.Green; Console.Write("Name of student - " + each.name + ",surname - " + each.surname + ",course - " + each.course + ",codebook - " + each.codebook); Console.ResetColor(); } Console.Read(); }