Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Reading a matrix from a text
I recently ran into this the other day, I'm not that good of a programmer, and the teacher asked us to make a program that reads a square matrix from a txt. and then use the information to solve it. I've been wondering how to do the first part of this program as I already figured it out how to solve the matrix, but I just don't know how to do the scanning of the text. Just so you guys can understand me, this is how the text would look like:
1 2 3 8
7 4 1 2
1 2 1 2
3 4 5 6
So as you can see, it has to read the first number and store it in a variable so the program knows the size of the matrix and then read the matrix and store it in an array or so I think.
Any help would be apreciated.