Click here to Skip to main content
14,603,917 members
Rate this:
Please Sign up or sign in to vote.
See more:
i have these values in csv file:


how can i store these values in 2 dimensional array
George Swan 22-Aug-15 2:53am
I would suggest that you have a look at this article

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

I'm not sure what your issue is ...

You declare and instantiate a 4 x 4 array of the appropriate data type - double ?
You declare and initialise an integer variable, for the row
You open, then read the file containing the values, line by line, maybe into a string
For each string holding a line of 'csv' values :-
a) you 'split' the line (hint) based on the ','
b) you loop through the split values and assign them to the columns for the current row, ie incrementing the column count from 0 to 3
c) you increment the row count

There's no error handling in the above - but its the gist of what you need to do - why don't you write some code and give it a go - its not hard - update your question with the code and any specific issues you have and you'll likely get more help
CPallini 22-Aug-15 3:15am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100