Ex. 7.3 — File I/O in C++

Ex. 7.3 — File I/O in C++

You cannot submit for this problem because the homework's deadline is due.

File

Just compress your ex3.cpp, which has #include "assignment.h" and doesn't has main() function and has function prototype as void ex3(), and upload the compressed zip

Description

Read two matrices \(A\) and \(B\) from a text file called matrices.txt. Compute \(A + B\), \(A \cdot B\) and \(A^T \cdot B^T\). Output the result into a text file named result.txt. Each row of a matrix is represented as a list of integers separated by a space. When the end of a row is reached a new one starts on the next line. Two matrices are separated by a blank line.

Format

Files

You should submit a tar file containing a c++ source file ex3.cpp, which contains a function void ex3() that realizes the requirement as is specified in the description.

Input Files

two matrices in matrices.txt with order \(n \leqslant 500\)

Output Files

the result in result.txt

Sample 1

Input: matrices.txt

-80 8
21 9

-63 -85
81 -44

Output: result.txt

-143 -77 
102 -35 

5688 6448 
-594 -2181 

3255 -7404 
-1269 252 

Limitation

1s, 32MiB for each test case #1 - #9.
10s, 32MiB for test case #10.

Homework 7 (Individual)

Not Claimed
Status
Finished
Problems
4
Open Since
2019-11-17 00:00
DDL
2019-11-20 23:59
Extension
72.0 hour(s)