private void Insert() { //추가할 번호 입력 int num = 0; Console.WriteLine("추가할 도서 번호를 입력:"); num = int.Parse(Console.ReadLine()); if (books[num] != null) { Console.WriteLine("이미 존재합니다."); return; } string title; Console.WriteLine("제목"); title = Console.ReadLine(); string author; Console.WriteLine("저자"); author = Console.ReadLine(); string publisher; Console.WriteLine("출판사"); publisher = Console.ReadLine(); int price = 0; Console.WriteLine("가격"); int.TryParse(Console.ReadLine(), out price); books[num] = new MyClass_Book(num, title, author, publisher, price); }
private void ViewBook(MyClass_Book book) { Console.WriteLine("<{0}>", book.BNum); Console.WriteLine("\t제목:{0}", book.Title); Console.WriteLine("\t출판사:{0}", book.Publisher); Console.WriteLine("\t저자:{0}", book.Author); Console.WriteLine("\t가격:{0}", book.Price); }