Task question 3

Write a program that reads an $ m\times n$ matrix $ A=(a_{ij})$ from a text file with $ m$ lines is a list of $ n$ double entries separated by a space, then output the homogeneous system $ Ax=0$ in explicit algebraic form with $ m$ lines of text having the following format:
$ a_{i1}$ * x[1] + $ \dots$ $ a_{in}$ * x[$ n$ ].
The name of the file containing the matrix and the integer $ n$ should be read from the command line.

For example, for the text file

  1 -2.3 3 0.0
  -9.123 2 -50 -1
you should obtain the following output:
x[1] - 2.3*x[2] + 3*x[3] = 0
-9.123*x[1] + 2*x[2] - 50*x[3] - x[4] = 0
Hint: if you have a file stream ifs and you want to read a double value off it, use the following construct.
double t;
ifs >> t;



Subsections

Leo Liberti 2008-01-12