TheMatrix operator/ (const TheMatrix& M1, const TheMatrix& M2) { { TheMatrix Result; for (int i=0; i< 5; i++) for (int j-0; j<5; j++) Result.M[i][j] M1.M[i][j]/M2.M[i][j]; return(Result ) ; } } int main) [Enter a file name: matrix1.txt [Enter a file name: matrix2 . txt Floating point exception
Types of Loop
Loops are the elements of programming in which a part of code is repeated a particular number of times. Loop executes the series of statements many times till the conditional statement becomes false.
Loops
Any task which is repeated more than one time is called a loop. Basically, loops can be divided into three types as while, do-while and for loop. There are so many programming languages like C, C++, JAVA, PYTHON, and many more where looping statements can be used for repetitive execution.
While Loop
Loop is a feature in the programming language. It helps us to execute a set of instructions regularly. The block of code executes until some conditions provided within that Loop are true.
I am getting a floating point exception in my code. Which is to divide matrix 1 by matrix 2 (striaight up .. not with linear alebgra) I was told to add an if/esle loop to fix it.. not sure what to do though can someone help ..
attached the division part of the code...
matrix one contains:
2 2 1 4 5
2 4 5 6 1
1 2 4 5 6
1 2 3 4 4
2 3 4 4 2
matrix 2 contains:
1 2 0 2 1
1 2 2 4 1
1 2 3 5 1
2 3 4 5 6
1 2 3 4 5
(matrix 2 needs to contain atleast one zer)
Trending now
This is a popular solution!
Step by step
Solved in 2 steps