00:01
Student a simple matrix program in c+ + that generate random matrix a and b of size n into n multiply them and write the result matrix c to the output file.
00:10
So here random values are taken into the matrices a and b.
00:15
So here i have taken the capital n its type is integer and it's a constant and its value i have initialized to 3.
00:22
We can take any value.
00:23
So here i have taken the function void type generate random matrix because here the matrix having the random number.
00:30
So i am taking as argument matrix 2d matrix n by n.
00:35
So here i am taking the 2 follows because of one for the row and second one for the column.
00:39
And here after this generate random number between 0 and 9.
00:44
So in 2d matrix we will call the we will fill the number by the rand function.
00:50
This will generate the random number between 0 and 9 0 up to 9.
00:54
So in this way we will fill the matrix matrix entries and now call the function multiply matrix.
01:03
So here its type is also void here i am using a 3 for loop int i equal to 0 int j equal to 0 and after this cij initialized to 0 and after this i have taken the third loop k equal to 0 as we know very well matrix multiplication is done with the help of a 3 loop.
01:23
So cij will be the new matrix and its value will be filled by multiplying aij.
01:30
So here cij plus aik into bkj.
01:34
So here rows of the first will be multiplied by the column of the second.
01:39
So in this way matrix multiplication will be performed as we know very well to perform the matrix multiplication.
01:47
So here first matrix and here second matrix.
01:53
So here suppose it's a it's b.
01:55
So here rows will be multiplied by the column of this one and here the result will be saved into the matrix c.
02:04
So in this way the matrix multiplication take place.
02:08
So here i have done with the help of a 3 loop.
02:10
So this will calculate the values of cij and all the entries of cij will be filled.
02:16
Now i am calling the main function in the main function seed the random number generator...