Functions, Files, and Arrays.

Hey everyone. I've got this assignment for my CSE class that I'm really lost on and I'd really appreciate some help. The tasks are as follow.

Task
1. Prompt the user for a file name to open which will contain an arbitrary number of n x m matrices.
2. Prompt the user for a file name to which the results will be saved.
3. Open the file and read in the next two matrices.
4. Error checking. Ensure the dimensions are legal to multiply. n x m * m x q
5. Multiply the matrices and print the result to a file.
6. Repeat steps 3 and 4 as necessary.
7. Close any files used and exit.

I know how to deal with functions and arrays, but using files and stuff was introduced just recently and I've been buried under work for my other classes and this stuff just flew over my head.

Edit: I also know how to multiply matrixes but im not sure how to access them from a file like the one above and then multiply them. Thanks ahead of time.

Btw the files with the matrices look like:

4 4
1.2 3.14 4.3 5.3
8.9 2.12 4.45 10
11 8.2 9.39 2.41
0.1 0.9 0.9 1.89

4 1
2 2 2 2

3 3
1.2 3.1 17.2
16.4 1.2 9.0
8.7 8.7 6.33


Any help will be greatly appreciated. Sorry if I'm just taking up space in the forum.
Last edited on
Topic archived. No new replies allowed.