示例#1
0
        public void ThemHinhTaiViTri(int location, int typeList)
        {
            HinhHoc hh = new HinhHoc();

            switch (typeList)
            {
            case 1:
                WriteLine("\nHinh Vuong >>");
                hh = new HinhTron();
                break;

            case 2:
                WriteLine("\nHinh Vuong >>");
                hh = new HinhVuong();
                break;

            case 3:
                WriteLine("\nHinh chu nhat >>");
                hh = new HinhChuNhat();
                break;

            default:
                WriteLine("\nCo loi gi do da xay ra! Out...");
                break;
            }
            ListHinhHoc.Add(hh.Nhap());
            ListHinhHoc.Insert(location, hh);
        }
示例#2
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;
            }
        }
示例#3
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");
        }
示例#4
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");
        }
示例#5
0
        public void Nhap()
        {
            HinhHoc hh         = new HinhHoc();
            string  isContinue = null;

            do
            {
                Write("\nBan muon nhap hinh gi (1 - HV, 2 - HT, 3 - HCN) >> ");
                int type = int.Parse(ReadLine());
                switch (type)
                {
                case 1:
                    WriteLine("\nHinh Vuong >>");
                    hh = new HinhTron();
                    break;

                case 2:
                    WriteLine("\nHinh Vuong >>");
                    hh = new HinhVuong();
                    break;

                case 3:
                    WriteLine("\nHinh chu nhat >>");
                    hh = new HinhChuNhat();
                    break;

                default:
                    WriteLine("Co loi gi do da xay ra! Vui long kiem tra lai");
                    break;
                }
                ListHinhHoc.Add(hh.Nhap());
                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");
        }