+ 1

5x5 matrix from Array

i need to create a 5x5 matrix from a single dimensional array, then calculate the sum of the second column, could people give any pointers https://code.sololearn.com/cCqU501ZrxKt/?ref=app

12th Nov 2017, 2:53 PM
Roguesquid
Roguesquid - avatar
7 Réponses
+ 12
I would suggest you to reconsider the structure to represent the data in an object-oriented way as we rarely need to go beyond 3D. Otherwise, Tuple would be a great choice too! 😉
12th Nov 2017, 3:21 PM
Zephyr Koo
Zephyr Koo - avatar
+ 12
In that case you can just create a 5D array and fill it up. That means you'll have something like this:- int[,,,,] arr = new int[1,2,3,4,5]; But I wouldn't recommend it as multidimensional array was known to cause performance issue, so please use it wisely. 😉
12th Nov 2017, 3:42 PM
Zephyr Koo
Zephyr Koo - avatar
+ 11
Would you mind to share with us the format of the data you're referring to? You can mask the sensitive info or replace with dummy values.
12th Nov 2017, 3:52 PM
Zephyr Koo
Zephyr Koo - avatar
+ 1
unfortunately, it has to be in that form, otherwise I would do that.
12th Nov 2017, 3:26 PM
Roguesquid
Roguesquid - avatar
+ 1
I have to use the elements from data, how could I do that
12th Nov 2017, 3:50 PM
Roguesquid
Roguesquid - avatar
+ 1
it's marks from a test, out of 1000. Can't tell you the format.
12th Nov 2017, 3:57 PM
Roguesquid
Roguesquid - avatar
0
Samuel send me your contact and this is mine +233555152349
13th Nov 2017, 9:12 PM
Theophilus Nyarko
Theophilus Nyarko - avatar