I have a text file that has 256 pairs of data. I need to take those pairs and put them into the vectors for the graph. I am know how to do this in C# but I am new to C++. The format of the text file is
125, 151
124, 176
ect...
I need it to come into the vectors for the graph in the format of graph[n][m], where n = 256 and m=256. So I would read through the file and would mark 1 on the number that corresponds with the L/R Pair. So for example 125, 151. I would go to the 125th line and I would mark the 151'st 0 to be 1.
[n][m]{{0,0,0... 1(//176th 0),0,0,0...}, //124th line
{0,0,0... 1(//151st 0),0,0,0...}, //125th line
ect.
Does C++ have anything like the streamreader method out of C#?
Here is a sample of the vectors for a 7x7 max flow problem.
int graph[V][V] = { {0, 6, 7, 0, 0, 0, 0},
{0, 0, 1, 3, 4, 0, 0},
{0, 0, 0, 2, 0, 5, 0},
{0, 0, 0, 0, 3, 2, 0},
{0, 0, 0, 0, 0, 0, 7},
{0, 0, 0, 0, 2, 0, 4},
{0, 0, 0, 0, 0, 0, 0}
};