C++
Write a program to calculate the sum of two matrices that are stored inside two-dimensional arrays. Your program should include three functions: one for getting input data, one for calculating the sum of matrices, and one for printing the result.
a) Function inputMatrix: This Function prompts the user to enter the data and stores data inside two-dimensional array.
b) Function addMatrices: This function calculatesthe sum result of two matrices.
c) Function printMatrix: This function prints the matrix to screen.
You need to use "#define SIZE x" directive to set the constant for the size of arrays to x (arbitrary integeger value, dont make it too big). To make things easier, you can set the number of rows equal to the number of columns.
It is recommended to write the functions with the following signatures:
void inputMatrix(int matrix[SIZE][SIZE]);
void addMAtrices (int matrix1[SIZE][SIZE]), int matrix2[SIZE][SIZE]), int sum[SIZE][SIZE]);
void printMatrix(int matrix[SIZE][SIZE]);

![//method for adding the natrices void addMatrices (int, matrixl [SIZE] [SIZE],int matrix2[SIZE] [SIZE],int sum[SIZE] [SIZE],i](http://img.homeworklib.com/questions/39251ab0-fa63-11eb-9295-859f6e3a23ac.png?x-oss-process=image/resize,w_560)
![//main method int main () //declaring variables int matrix1[SIZE] [SIZE], matrix2[SIZE] [SIZE], sum[SIZE] [SIZE], rows, colsi](http://img.homeworklib.com/questions/39e7e5e0-fa63-11eb-9d0c-477402b44615.png?x-oss-process=image/resize,w_560)

Executable code:
#include<iostream>
//defining the size
#define SIZE 10
using namespace std;
//method to input the matrix
void inputMatrix(int a1[SIZE][SIZE],int rows,int cols)
{
int a,b;
for(a=1;a<=rows;a++)
{
for(b=1;b<=cols;b++)
{
cout<<"Enter
Element:"<<a<<":"<<b<<"=";
cin>>a1[a][b];
}
}
}
//method for adding the natrices
void addMatrices(int matrix1[SIZE][SIZE],int
matrix2[SIZE][SIZE],int sum[SIZE][SIZE],int rows,int cols)
{
int a,b;
for(a=1;a<=rows;a++)
{
for(b=1;b<=cols;b++)
{
sum[a][b] = (matrix1[a][b] +
matrix2[a][b]);
}
}
}
//method for printing the matrices
void printMatrix(int matrix[SIZE][SIZE],int rows,int cols)
{
int a,b;
for(a=1;a<=rows;a++)
{
for(b=1;b<=cols;b++)
{
cout<<matrix[a][b]<<endl;
}
cout<<"\n";
}
}
//main method
int main()
{
//declaring variables
int
matrix1[SIZE][SIZE],matrix2[SIZE][SIZE],sum[SIZE][SIZE],rows,cols;
//getting inputs
cout<<"Enter No:Of rows
:"<<endl;
cin>>rows;
cout<<"Enter No:Ofcolomns
:"<<endl;
cin>>cols;
//calling functions
inputMatrix(matrix1,rows,cols);
inputMatrix(matrix2,rows,cols);
addMatrices(matrix1,matrix2,sum,rows,cols);
printMatrix(sum,rows,cols);
system("pause");
return 0;
}
C++ Write a program to calculate the sum of two matrices that are stored inside two-dimensional...
Write a function to add two one-dimensional matrices of integer values. The matrices are represented as arrays of int and the function must return the result as a pointer to a new dynamically allocated array of int. You can assume the parameters are always of length greater than 0 and that no errors can occur.
in c++ Develop a program (name it AddMatrices) that adds two user provided matrices. The matrices must of the same size. The program defines method Addition() that takes two two-dimensional arrays of integers and returns their addition as a two-dimensional array. The program main method defines two 3-by-3 arrays of type integer. The method prompts the user to initialize the arrays. Then it calls method Addition(). Finally, it prints out the array retuned by method Addition(). Document your code, and...
Language is C++ Basic principles and theory of structured programming in C++ by implementing the class: Matrix Use these principles and theory to help build and manipulate instances of the class (objects), call member functions Matrix class implementation from the main function file and, in addition, the Matrix class must have its interface(Matrix.h) in a separate file from its implementation (Matrix.cpp). The code in the following files: matrix.h matrix.cpp matrixDriver.h Please use these file names exactly. Summary Create three files...
Develop a program in c++ (name it AddMatrices) that adds two matrices that a user inputs. The matrices must of the same size. The program defines method Addition() that takes two two-dimensional arrays of integers and returns their addition as a two-dimensional array. The program main method defines two 3-by-3 arrays of type integer. The method prompts the user to initialize the arrays. Then it calls method Addition(). Finally, it prints out the array retuned by method Addition(). Document your...
Create a program that:Receives as input in command line the sizes [rows] and [cols] of a two dimensional array, and [minValue] and [maxValue] between which the random numbers will be generated. Assume maxValue <= 999Generates two random two dimensional array with numbers between minValue and maxValue (inclusive) with the given size (rows x cols), and store them in m1 and m2Compute the sum of the two matrices and stores the result in a new matrix mSum.
Write a C++ program to read two matrices with any size. Your program should have at least the following functions: Main() Read a matrix Add two matrices Subtract two matrices Multiply two matrices Divide two matrices Display a matrix
Write a C++ program to scale and average the values in a two-dimensional array. Write the following functions: void randomize2DArray(int arr[ROW_SIZE][COL_SIZE]) – places random values between 1 and 100 in a two-dimensional array . void scale2DArray(int arr[ROW_SIZE][COL_SIZE], double scale) – multiplies every value in the two-dimensional array by scale. double average2DArray(int arr[ROW_SIZE][COL_SIZE]) – calculates the average value over all elements in the two-dimensional array. Randomize and print the values in the two-dimensional array of size 7 x...
Write a MIPS program to that will take two 4x4 matrices, and calculate their sum and product, using row major, and column major math (so this is actually 4 problems, but obviously they’re all pretty related). I generated two sample arrays to test 2 1 9 2 7 9 10 10 3 4 4 4 2 5 4 4 8 7 1 2 2 7 8 6 7 5 6 8 9 4 8 9 The output of your program...
Exercise 3: Write a method to add two matrices. The header of the method is: I public static double[][] addMatrix(double [ ][] a, double[][] b) In order to be added, the two matrices must have the same dimensions and the same or compatible types of elements. Let e be the resulting matrix. Each element c is c -a, +b For example, for two 3x3 matrices a and b, c is Write a test program that (a) prompts the user to...
Read your notes concerning 2D arrays with particular attention to the syntax of passing arrays as parameters to functions. Write the pseudocode (algorithm) for the following program definition: A text file contains a square matrix of integer numbers. The file contains an integer number indicating the identical number of rows and columns followed by the data itself (that number cannot be larger than 100). For example, a file containing a 3x3 matrix would contain 3 followed by 9 other integer...