Matrix Addition with Rational Entries

  1. Combine your CRational class and CMatrix class so that you can handle matrices whose entries are rational numbers, instead of being limited to only integers.
  2. Certainly, you have to modify your CMatrix::Read() function so that it will read rational numbers instead of integers only.
  3. Test your classes with the following main program:
    cin >> n;
    CMatrix a(n,n), b(n,n), c(n,n);
    a.Read();
    b.Read();
    c = a + b;
    c.Print();  
    For the input
    2
    1/2 1/3
    1/4 1/5
    1/4 1/2
    1/4 1/2  
    The result should look like
    3/4 5/6
    1/2 7/10