Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Without using a 2D array Write a program in C++ With the user input find out The matrix is N x N The matrix determinant

Without using a 2D array

Write a program in C++

With the user input find out

The matrix is "N x N"

The matrix determinant

User input is entered only with spaces and enter for the next line, example: "This is all the user will input", theres no press 1 to keep adding, or 2 to exit.

1 -2 3

4 5 -6

7 -8 9

how can i use getline(cin, xxxx) to read this, the idea is to read the first line "1 -2 3" and count how many numbers/columns in the row, so that i can then loop the other rows with an expected number of rows and columns, if the row is incomplete an error message should pop up.

Example:

---------------------------------------

User Input 1:

1 2 -3

4 5 0

Output 1:

Not a square matrix!

---------------------------------------

User Input 2:

1 0 2

-1 0 -1

0 1 0

Output 2:

Yes! Matrix is square N x N, where n is = 3.

the determinant is: -1

---------------------------------------

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.

The determinant is: 0

---------------------------------------

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.

The determinant is: 7616

---------------------------------------

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 or vector of vectors, but not a 2D-array

Thank you

Thank you for reading, we can not use a 2D-array or an array so Linked list or vectors are the options, but mainly I cant seem to get the user input to start this. thank you

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2014 Nancy France September 15 19 2014 Proceedings Part 3 Lnai 8726

Authors: Toon Calders ,Floriana Esposito ,Eyke Hullermeier ,Rosa Meo

2014th Edition

3662448440, 978-3662448441

More Books

Students also viewed these Databases questions

Question

4. How has e-commerce affected business-to-business transactions?

Answered: 1 week ago