public Matran Hieu2MT(Matran a, Matran b)
{
Matran c = new Matran(this.So_Hang, this.So_Cot);
if (a.So_Hang == b.So_Hang && a.So_Cot == b.So_Cot)
{
for (int i = 0; i < this.So_Hang; i++)
{
for (int j = 0; j < this.So_Cot; j++)
c.MT[i, j] = a.MT[i, j] - b.MT[i, j];
}
}
else
{ Console.WriteLine("\n\t Khong tru duoc !!!"); }
return c;
}
// Xuat Ma tran
//public void XuatMT()
//{
// Console.WriteLine("\t Ma tran: \n");
// for (int i = 1; i <= this.So_Hang; i++)
// {
// for (int j = 1; j <= this.So_Cot; j++)
// {
// Console.Write("\t" + this.MT[i,j] +" ");
// }
// Console.WriteLine();
// }
//}
case 4:
Console.WriteLine("\n\t Nhap ma tran thu 1: ");
M1.NhapMT();
Console.WriteLine("\n\t Nhap ma tran thu 2: ");
M2.NhapMT();
Console.WriteLine("\t Hieu hai ma tran la: ");
M3.Hieu2MT(M1, M2);
M3.XuatMT();
Console.ReadLine();
break;
- I can minus 2 matrix. I dont understand reason why!!! I can print matrix M3. Can anyone help me? Thank you so much!