I have a text file that have the following data,

0 1 2 3 4 5 6 7 8 9 10

11 12 13 14 15 16 17

18 19 20 21 22 23 24

I have put those values into a one dimension array already using a loop and infile >> Line0 >> Line1 >> Line2 >> ....

So for example Line0[0] would be 0. Line0[1] would be 11. Line0[2] would be 18. Line1[1] would be 1 and so forth.

What my question is how do we use a loop to add up the sum of the top row(0 1 2 3 4 5 6 7 8 9 10)?

Is there a method to change part of the variable name? I am thinking of something like this:

int i;

i=0;

Linei[0].

From there I just create a simple loop to keep adding the sum.

I know the above code will give you an undeclared variable but is it possible to do that? Or should I be looking for another method? Thanks.