public MangPhanSo TimPhanSoDuong() { MangPhanSo kq = new MangPhanSo(); for (int i = 0; i < length; i++) { if (a[i].tu / a[i].mau > 0) { kq.Them(a[i]); } } return(kq); }
public MangPhanSo TimPhanTuXuatHienNhieuNhat() { MangPhanSo kq = new MangPhanSo(); int max = DemSoLanXuatHienNhieuNhat(); for (int i = 0; i < length; i++) { if (DemSoLanXuatHien(a[i]) == max && !KiemTraTonTai(a[i])) { kq.Them(a[i]); } } return(kq); }
static void Main(string[] args) { //Tao mot doi tuong a thuoc kieu Phan So //PhanSo a = new PhanSo(); //PhanSo a = new PhanSo(1, 2); //PhanSo b = new PhanSo(3, 4); //// a.Nhap(); //a.Xuat(); //b.Xuat(); //PhanSo kq = a.Cong(a, a); //kq.Xuat(); MangPhanSo m = new MangPhanSo(); m.NhapNgauNghien(); m.Xuat(); //m.TinhTong().Xuat(); Console.WriteLine("Danh sach phan so duong "); //m.TimPhanSoDuong().Xuat(); m.TimPhanTuXuatHienNhieuNhat().Xuat(); Console.ReadKey(); }