public void KhoiTaoDaThuc() { for (int i = 0; i < this.soLuongDonThuc; i++) { DonThuc mDonThuc = this[i]; mDonThuc.soMuN = i; Console.Write("Vui long nhap he so a tai don thuc thu " + i + " :"); mDonThuc.heSoA = double.Parse(Console.ReadLine()); } }
public DaThuc(int soLuongDonThuc) { mangDonThuc = new DonThuc[soLuongDonThuc]; this.soLuongDonThuc = soLuongDonThuc; // Khoi tao cac don thuc trong da thuc for (int i = 0; i < this.soLuongDonThuc; i++) { this[i] = new DonThuc(1, i); } }
public void prettyPrint() { Console.WriteLine("In da thuc:"); for (int i = 0; i < this.soLuongDonThuc; i++) { DonThuc mDonThuc = this[i]; Console.Write(mDonThuc.heSoA + "*" + "x^" + mDonThuc.soMuN); if (i != this.soLuongDonThuc - 1) { Console.Write("+"); } } Console.WriteLine(); }
public DaThuc() { mangDonThuc = new DonThuc[1]; mangDonThuc[0] = new DonThuc(); }