how can you read and store a matrix?! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

how can you read and store a matrix?!

read and store a matrix that contains char and double variables. i rly search it and try to write a code and everything fails. Someone have any ideas? in the same txt file i have more matrixes that have different number of rows and cols :( and the matrixes are splited by a sign/number, so please tell some source or smth to look for :) any tip is welcome. thx again

18th Aug 2016, 10:44 PM
Derder Der
Derder Der - avatar
3 Answers
+ 3
I think with matrix you are only able to assign one datatype. I would suggest you to try multidimensional arrays or vectors, but still I doubt that it will be easy to fill them both with double and chars. You could easily use a structure variable to assign different things to it and store it.
19th Aug 2016, 7:17 AM
Tensa
Tensa - avatar
+ 1
Tensa is absolutely right. Try creating a class datatype appropriate to your program and then store it in a vector. Or you could use multiple vectors and traverse them using a function. Or nest a vector in a vector. There are a lot of ways of doing this. Some more "correct" than others.
19th Aug 2016, 7:29 AM
Donovan
Donovan - avatar
0
thank you for the suggestions :)
30th Aug 2016, 11:41 AM
Derder Der
Derder Der - avatar