private void Button_Click_1(object sender, RoutedEventArgs e) { HinhTron ht = new HinhTron(3); ht.CV(); ht.DT(); MessageBox.Show("\nChu vi HinhTron: " + ht.chuvi.ToString() + "\nDien Tich HinhTron: " + ht.dientich.ToString()); LstHinhTron.Items.Add("STT" + "\t\t" + "Canh" + "\t\t" + "ChuVi" + "\t\t" + "DienTich"); hinhtrons = new List <HinhTron>(); int[] bankinh = { 6, 3, 10, 9, 5 }; for (int i = 0; i < 5; i++) { hinhtrons.Add(new HinhTron(bankinh[i])); } for (int i = 0; i < bankinh.Length; i++) { hinhtrons[i].CV(); hinhtrons[i].DT(); LstHinhTron.Items.Add("HinhTron " + (i + 1).ToString() + "\t" + hinhtrons[i].BanKinh.ToString() + "\t\t" + hinhtrons[i].chuvi.ToString() + "\t\t" + hinhtrons[i].dientich.ToString()); } }
private void btnOK_Click(object sender, RoutedEventArgs e) { HinhCN hcn = new HinhCN(4, 3); HinhVuong hv = new HinhVuong(3); HinhTron ht = new HinhTron(3); hcn.ChuVi(); hcn.DienTich(); hv.ChuVi(); hv.DienTich(); ht.ChuVi(); ht.DienTich(); MessageBox.Show("Chu vi HinhCN: " + hcn.chuvi.ToString() + "\nDien Tich HinhCN: " + hcn.dientich.ToString() + "\n" + "\nChu vi HinhVuong: " + hv.chuvi.ToString() + "\nDien Tich HinhVuong: " + hv.dientich.ToString() + "\n" + "\nChu vi HinhTron: " + ht.chuvi.ToString() + "\nDien Tich HinhTron: " + ht.dientich.ToString()); }
private void btnOK_Click(object sender, RoutedEventArgs e) { HinhTron[] hinhtrons = new HinhTron[5]; int[] banKinh = { 3, 5, 2, 3, 5 }; for (int i = 0; i < hinhtrons.Length; i++) { hinhtrons[i] = new HinhTron(banKinh[i]); } for (int i = 0; i < hinhtrons.Length; i++) { hinhtrons[i].ChuVi(); hinhtrons[i].DienTich(); lstHinhTron.Items.Add((i + 1).ToString() + "\t\t" + hinhtrons[i].R.ToString() + "\t\t" + hinhtrons[i].chuvi.ToString() + "\t\t" + hinhtrons[i].dientich.ToString()); lb1.Content = "STT" + "\t\t" + "Ban Kinh" + "\t\t" + "Chu Vi" + "\t\t" + "Dien Tich"; } HinhVuong[] hinhVuongs = new HinhVuong[5]; int[] canh = { 3, 5, 2, 3, 5 }; for (int i = 0; i < hinhVuongs.Length; i++) { hinhVuongs[i] = new HinhVuong(canh[i]); } for (int i = 0; i < hinhVuongs.Length; i++) { hinhVuongs[i].ChuVi(); hinhVuongs[i].DienTich(); lstHinhVuong.Items.Add((i + 1).ToString() + "\t\t" + hinhVuongs[i].Canh.ToString() + "\t\t" + hinhVuongs[i].chuvi.ToString() + "\t\t" + hinhVuongs[i].dientich.ToString()); lb1_Copy.Content = "STT" + "\t\t" + "Canh" + "\t\t" + "Chu Vi" + "\t\t" + "Dien Tich"; } }