Read all of this description before doing any of it.
When you are done, your program will accomplish the following.
numbers
,
the input file will be numbers.in
and the output file will be numbers.out
.
The input file will be formatted as follows. The first line will contain the number of rows, then the number of columns, separated by a space. The next set of lines will contain the numbers of the first matrix. Each row's numbers will appear on one line, separated by spaces. A single blank line will separate the two matrices. The next set of lines will contain the numbers of the second matrix in the same form.
For example, the following matrices:
1.2 | 5.0 |
0.3 | 0.2 |
2.7 | -5.6 |
6.0 | 1.3 |
0.4 | -1.3 |
-3.1 | -0.2 |
small.in
in the Eclipse project.
Recall that the sum of two matrices is just computed element-by-element. For example, the sum of the two matrices above is
7.2 | 6.3 |
0.7 | -1.1 |
-0.4 | -5.8 |
To do this project, do the TODO's in the project file. But note:
strcpy
followed by strcat
makes it easy to construct
the input and output filenames from the basename. fscanf
for reading from the input files is the easiest approach for this project. fscanf
for reading from the input files is the easiest approach for this project.