Write a program that adds two matrices A and B of order 2X4 and store the result in third matrix C and C is stored in a file “result.txt. The program should take the values from the user in the matrices through a function input. The addition of the Matrices should be calculated through a function add. The resultant matrix should be written in the file through a function save. Also display the result in a good looking format on the screen in a function show() .
Design and Implementation:
You are required to make three functions named as:
This function will read values in the two Matrices.
This function will take the two Matrices as arguments and add them and the result will be stored in a third matrix.
This function will take the resultant matrix as argument and saves it to a file.
This function will display the resultant matrix on the screen.
Hint 1: A two dimensional array is known as matrix in mathematics.
Hint 2: show() and save() should be called from add() respectively.
The following prototypes for the respective functions can be used to implement the above mentioned problem:
void Add( int arr1 , int arr2 );
void show( int array3 );
void save( int arr3 );
Your output can be similar with the following:
Enter values for first A:
Enter values for B:
Matrix C is:
6 5 4 2
13 12 3 8[/i] :eek: