I/O help

Hi I have set myself a challenge to help me improve my understanding of the I/O streams and have got stuck on how to proceed. Here is the challenge I set myself:

I would like to read multiple files each containing the same number of rows and columns. What I would then like to do is place each value in a separate file. However when opening any other files they would have their values placed in the files just created but underneath/next to the value(s) that are is/are currently in there. Like so:

Imagine 3 input files like this:
1
2
3
1,2,3,4,
5,6,7,8,
9,10,11,12


I would like the programme to then create files named like so:

[0][1].txt indicating the value position. Where [0] represents the row and [1] represents the column (starting from 0). This should produce 12 files in this example. Some example of what the files would contain from the above example:


[0][0].txt
1,1,1,

[0][1].txt
2,2,2,

[2][3].txt
12,12,12,

Here is what I have written so far:



I am confused at how exactly to go about extracting just 1 value at a time and placing it in the new file. Have I approached this at the wrong angle?

Please let me know if something I have said is not clear. Thanks for your time.

EDIT: I have managed to do it. I placed all the values into a vector
Last edited on
Topic archived. No new replies allowed.