コード例 #1
0
        public DanhSachHinhHoc TimHinhCoDTMin(DanhSachHinhHoc a)
        {
            DanhSachHinhHoc ds  = new DanhSachHinhHoc();
            float           min = a.TimMin_DT();

            foreach (var item in a.DSHinhHoc)
            {
                if (item.TinhDienTich() == min)
                {
                    ds.Them(item);
                }
            }
            return(ds);
        }
コード例 #2
0
        public DanhSachHinhHoc Tim_Hinh_CV_Min(DanhSachHinhHoc a)
        {
            DanhSachHinhHoc DS  = new DanhSachHinhHoc();
            float           min = a.TimMin_CV();

            foreach (var item in a.DS_HH)
            {
                if (item.Tinh_ChuVi() == min)
                {
                    DS.Them(item);
                }
            }
            return(DS);
        }
コード例 #3
0
        public DanhSachHinhHoc Tim_Hinh_DT_Max(DanhSachHinhHoc a)
        {
            DanhSachHinhHoc DS  = new DanhSachHinhHoc();
            float           max = a.TimMax_DT();

            foreach (var item in a.DS_HH)
            {
                if (item.Tinh_DienTich() == max)
                {
                    DS.Them(item);
                }
            }
            return(DS);
        }
コード例 #4
0
        //Tim hcn dien tich nho nhat
        public DanhSachHinhHoc TimHCNDTMin(DanhSachHinhHoc a)
        {
            DanhSachHinhHoc ds  = Tim_DS_HCN(a);
            DanhSachHinhHoc kq  = new DanhSachHinhHoc();
            float           min = ds.TimMin_DT();

            for (int i = 0; i < ds.Dai; i++)
            {
                if (ds[i].TinhDienTich() == min)
                {
                    kq.Them(ds[i]);
                }
            }
            return(kq);
        }
コード例 #5
0
        //Tim hinh vuong dien tich max min
        public DanhSachHinhHoc TimHVDTMax(DanhSachHinhHoc a)
        {
            DanhSachHinhHoc ds  = Tim_DS_HV(a);
            DanhSachHinhHoc kq  = new DanhSachHinhHoc();
            float           max = ds.TimMax_DT();

            for (int i = 0; i < ds.Dai; i++)
            {
                if (ds[i].TinhDienTich() == max)
                {
                    kq.Them(ds[i]);
                }
            }
            return(kq);
        }
コード例 #6
0
        public DanhSachHinhHoc Tim_HCN_DT_Min(DanhSachHinhHoc a)
        {
            DanhSachHinhHoc kq  = new DanhSachHinhHoc();
            DanhSachHinhHoc DS  = Tim_DS_HCN(a);
            float           min = DS.TimMin_DT();

            foreach (var item in a.DS_HH)
            {
                if (item.Tinh_DienTich() == min)
                {
                    kq.Them(item);
                }
            }
            return(kq);
        }
コード例 #7
0
        //Các hàm thực hiện chức năng của menu
        public DanhSachHinhHoc Tim_HV_DT_Max(DanhSachHinhHoc a)
        {
            DanhSachHinhHoc kq  = new DanhSachHinhHoc();
            DanhSachHinhHoc DS  = Tim_DS_HV(a);
            float           max = DS.TimMax_DT();

            foreach (var item in a.DS_HH)
            {
                if (item.Tinh_DienTich() == max)
                {
                    kq.Them(item);
                }
            }
            return(kq);
        }
コード例 #8
0
        public void XoaHinhCoDTMin(DanhSachHinhHoc a)
        {
            float           min = a.TimMin_DT();
            DanhSachHinhHoc ds  = new DanhSachHinhHoc();

            foreach (var item in a.DSHinhHoc)
            {
                if (item.TinhDienTich() == min)
                {
                    ds.Them(item);
                }
            }
            foreach (var item in ds.DSHinhHoc)
            {
                a.Xoa(item);
            }
        }
コード例 #9
0
        //Xoa hinh co cv lon nhat
        public void XoaHinhCoCVMax(DanhSachHinhHoc a)
        {
            float           max = a.TimMax_CV();
            DanhSachHinhHoc ds  = new DanhSachHinhHoc();

            foreach (var item in a.DSHinhHoc)
            {
                if (item.TinhChuVi() == max)
                {
                    ds.Them(item);
                }
            }
            foreach (var item in ds.DSHinhHoc)
            {
                a.Xoa(item);
            }
        }
コード例 #10
0
        public void Xoa_Hinh_CV_Min(DanhSachHinhHoc a)
        {
            float           min    = a.TimMin_CV();
            DanhSachHinhHoc DS_Xoa = new DanhSachHinhHoc();

            foreach (var item in a.DS_HH)
            {
                if (item.Tinh_ChuVi() == min)
                {
                    DS_Xoa.Them(item);
                }
            }
            foreach (var item in DS_Xoa.DS_HH)
            {
                a.Xoa(item);
            }
        }
コード例 #11
0
        public void Xoa_Hinh_DT_Max(DanhSachHinhHoc a)
        {
            float           max    = a.TimMax_DT();
            DanhSachHinhHoc DS_Xoa = new DanhSachHinhHoc();

            foreach (var item in a.DS_HH)
            {
                if (item.Tinh_DienTich() == max)
                {
                    DS_Xoa.Them(item);
                }
            }
            foreach (var item in DS_Xoa.DS_HH)
            {
                a.Xoa(item);
            }
        }
コード例 #12
0
        //Tim hinh tron co ban kinh max
        public DanhSachHinhHoc TimHTBKMax(DanhSachHinhHoc a)
        {
            DanhSachHinhHoc ds  = Tim_DS_HT(a);
            DanhSachHinhHoc kq  = new DanhSachHinhHoc();
            float           max = ds.TimMax_BK();

            for (int i = 0; i < ds.Dai; i++)
            {
                if (ds[i] is HinhTron)
                {
                    HinhTron ht = (HinhTron)ds[i];
                    if (ht.BanKinh == max)
                    {
                        kq.Them(ds[i]);
                    }
                }
            }
            return(kq);
        }
コード例 #13
0
        public DanhSachHinhHoc Tim_HT_BK_Max(DanhSachHinhHoc a)
        {
            DanhSachHinhHoc kq  = new DanhSachHinhHoc();
            DanhSachHinhHoc DS  = Tim_DS_HT(a);
            float           max = DS.TimMax_BK();

            foreach (var item in a.DS_HH)
            {
                if (item is HinhTron)
                {
                    HinhTron t = (HinhTron)item;
                    if (t.bk == max)
                    {
                        kq.Them(item);
                    }
                }
            }
            return(kq);
        }
コード例 #14
0
        public void NhapTuFile()
        {
            string       fileName = "data.txt";
            StreamReader sr       = new StreamReader(fileName);
            string       line     = "";

            while ((line = sr.ReadLine()) != null)
            {
                string[] str = line.Split(' ');
                if (str[0] == "HT")
                {
                    DS.Them(new HinhTron(float.Parse(str[1])));
                }
                else if (str[0] == "HV")
                {
                    DS.Them(new HinhVuong(float.Parse(str[1])));
                }
                else
                {
                    DS.Them(new HinhCN(float.Parse(str[1]), float.Parse(str[2])));
                }
            }
        }