コード例 #1
0
        //CÂU E: THÊM MỘT MẶT HÀNG VÀO KHO
        static void CauE(ListQueue q)
        {
            Console.WriteLine("--------THEM MAT HANG VAO KHO-------");
            Console.Write("Nhap Ten mat hang : ");
            string ten = Console.ReadLine();

            Console.Write("Nhap so luong : ");
            int.TryParse(Console.ReadLine(), out int soluong);

            Console.Write("Nhap don gia : ");
            int.TryParse(Console.ReadLine(), out int dongia);

            q.EnQueue(new HangHoa(ten, soluong, dongia));
        }
コード例 #2
0
        //Input
        static ListQueue Input()
        {
            ListQueue q = new ListQueue();

            using (StreamReader sR = new StreamReader("C:\\Users\\HUNG\\Desktop\\C#\\CTDL_Cô Trinh\\Chương 5\\BT4_C5\\Input.txt"))
            {
                while (sR.Peek() > 0)
                {
                    string[] sLine = sR.ReadLine().Split('#', StringSplitOptions.RemoveEmptyEntries);
                    int.TryParse(sLine[1], out int soluong);
                    int.TryParse(sLine[2], out int dongia);

                    q.EnQueue(new HangHoa(sLine[0], soluong, dongia));
                }
            }

            return(q);
        }