Exemplo n.º 1
0
        public void ThemHinhTaiViTri(int location, TypeList typeList)
        {
            switch (typeList)
            {
            case TypeList.HinhVuong:
                HinhTron ht = new HinhTron();
                ht.Nhap();
                ListHinhHoc.Insert(location, ht);
                break;

            case TypeList.HinhTron:
                WriteLine("\nHinh Vuong >>");
                HinhVuong hv = new HinhVuong();
                hv.Nhap();
                ListHinhHoc.Insert(location, hv);
                break;

            case TypeList.HinhChuNhat:
                WriteLine("\nHinh chu nhat >>");
                HinhChuNhat hcn = new HinhChuNhat();
                hcn.Nhap();
                ListHinhHoc.Insert(location, hcn);
                break;

            default:
                WriteLine("\nCo loi gi do da xay ra! Out...");
                break;
            }
        }
Exemplo n.º 2
0
        public void ThemHinhTaiViTri(int location)
        {
            //for (int i = ListHinhHoc.Count - 1; i >= location; i--)
            //	ListHinhHoc[i] = ListHinhHoc[i - 1];
            //ListHinhHoc[location] = ListHinhHoc.RemoveAt()
            string isContinue = "";

            do
            {
                Write("\n\nNhap vao vi tri x can them >> ");
                location = int.Parse(ReadLine());
                Clear();
                Write("\nBan muon them hinh gi? Moi nhap hinh tuong ung ( 'HV' - 'HT' - 'HCN' ) >> ");
                isContinue = ReadLine().ToUpper();
                if (isContinue == "HT")
                {
                    WriteLine("\nHinh tron >>");
                    HinhTron ht = new HinhTron();
                    ht.Nhap();
                    ListHinhHoc.Insert(location, ht);
                }
                else if (isContinue == "HV")
                {
                    WriteLine("\nHinh Vuong >>");
                    HinhVuong hv = new HinhVuong();
                    hv.Nhap();
                    ListHinhHoc.Insert(location, hv);
                }
                else if (isContinue == "HCN")
                {
                    WriteLine("\nHinh chu nhat >>");
                    HinhChuNhat hcn = new HinhChuNhat();
                    hcn.Nhap();
                    ListHinhHoc.Insert(location, hcn);
                }
                else
                {
                    WriteLine("Ban phai nhap 1 tron 3 dinh dang o tren ( 'HV' - 'HT' hoac 'HCN' )");
                    ReadLine();
                }
                WriteLine("\n\tBan co muon nhap nua khong ?");
                Write("Nhan phim bat ki de tiep tuc. Go 'No' neu khong! >> ");
                isContinue = ReadLine().ToUpper();
            } while (isContinue != "NO");
        }
Exemplo n.º 3
0
        public void Nhap()
        {
            string isContinue = "";

            do
            {
                WriteLine("\nHinh tron >>");
                HinhTron ht = new HinhTron();
                ht.Nhap();
                Them(ht);
                WriteLine("\nHinh Vuong >>");
                HinhVuong hv = new HinhVuong();
                hv.Nhap();
                Them(hv);
                WriteLine("\nHinh chu nhat >>");
                HinhChuNhat hcn = new HinhChuNhat();
                hcn.Nhap();
                Them(hcn);
                WriteLine("\n\tBan co muon nhap nua khong ?");
                Write("Nhan phim bat ki de tiep tuc. Go 'No' neu khong! >> ");
                isContinue = ReadLine().ToUpper();
            } while (isContinue != "NO");
        }