Question: Write a program using C++ check if the user input is a N x N Matrix, input column is separated by spaces and rows are
Write a program using C++
check if the user input is a N x N Matrix, input column is separated by spaces and rows are separated by line space
thank you!
Example:
---------------------------------------
User Input 1:
1 2 3
4 5 6
Output 1:
Not a square matrix!
---------------------------------------
User Input 2:
1 2 3
4 5 6
7 8 9
Output 2:
Yes! Matrix is square N x N, where n is = 3.
---------------------------------------
User Input 3:
1 2 3 4 5
2 3 4 5 6
3 4 5 6 7
4 5 6 7 8
5 6 7 8 9
Output 3:
Yes! Matrix is square N x N, where n is = 5.
---------------------------------------
User Input 4:
11 21 31 41 51
-2 3 -4 5 6
13 14 15 16 17
4 -5 6 -7 8
-5 6 -7 8 -9
Output 4:
Yes! Matrix is square N x N, where n is = 5.
---------------------------------------
User Input 5:
1 2 3
4 5 6
7 8
Output 5:
Not a square matrix!
---------------------------------------
Please keep in mind negative numbers are also allowed, I need to use linked list and not a 2D-array, later on to find the determinant, but for right now I am completely stuck on how to read the user input and check if this is a square matrix or not.
Thank you
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
