Hi all, I need to read a text file (I've attached it, you can take a look), and then store all the numbers in it into a 2D array. After which, I need to parse it. I need urgent help here! ):
Sunshineserene
0
Junior Poster
Recommended Answers
Jump to PostIt's printing 1000^2=1,000,000 elements, it won't fit in your console screen, and it will take some time to stop. If you want to be sure, make another, smaller, file and make the matrix 10^10 - then see if it prints all the elements.
Jump to PostFor example, in line 87 in the new code you have the exact same loop as in the older code, and you are not changing the indices, just like you didn't do in the older code. You have changed it in the older code and now it works - and …
Jump to PostThe number of cells in your matrix should be the same as the numbers of elements in the text file - every extra cell has its initial value to be a 0.0. If you take my text file and put the matrix to be 4x4, you will see extra 0.0.
Jump to PostWhile inserting the elements to the matrix you can count which cells were used, and then print only them to the user.
Jump to PostYour matrix is 1000*1000, and you don't want to print all of the values, and you don't want to change the size of the matrix. My suggestion is to save the values of x and y that you use when inserting the values into the matrix, and use them when …
All 49 Replies
leiger
14
Junior Poster in Training
coil
Sunshineserene
0
Junior Poster
apines
116
Practically a Master Poster
Featured Poster
Sunshineserene
0
Junior Poster
Sunshineserene
0
Junior Poster
apines
116
Practically a Master Poster
Featured Poster
Sunshineserene
0
Junior Poster
apines
116
Practically a Master Poster
Featured Poster
Sunshineserene
0
Junior Poster
apines
116
Practically a Master Poster
Featured Poster
Sunshineserene
0
Junior Poster
apines
116
Practically a Master Poster
Featured Poster
Sunshineserene
0
Junior Poster
Sunshineserene
0
Junior Poster
apines
116
Practically a Master Poster
Featured Poster
Sunshineserene
0
Junior Poster
Sunshineserene
0
Junior Poster
coil
Sunshineserene
0
Junior Poster
Sunshineserene
0
Junior Poster
apines
116
Practically a Master Poster
Featured Poster
Sunshineserene
0
Junior Poster
apines
116
Practically a Master Poster
Featured Poster
Sunshineserene
0
Junior Poster
apines
116
Practically a Master Poster
Featured Poster
Sunshineserene
0
Junior Poster
apines
116
Practically a Master Poster
Featured Poster
Sunshineserene
0
Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.