Hi there,
I am trying to read integers from a file and store them into an array but I have no idea how to do it. The file is a text document whos contents are arranged like an adjacency list.
Here is an example file:
0 : 2,4,5,6,10
1 : 3,9,10
2 : 0
3 : 1,8
4 : 0,7,9,10
5 : 0,1,3,6
6 : 0,5,7
8 : 3,9
9 : 1,4,3
10: 0,1,4
To the left of the colon will represent the indices of the array and to the right represent values which I will store in another array.
Any ideas on how to do this?
Also, is it possible to count the number of lines first?