# Answer to Question #7297 in C++ for Jason

Question #7297
Hi, I need to find a solution or way to do this: I read ints from a txt by pairs.
(e.g: row 1 = 2,1 row 2 = 6,6 (including comma)) then I add them to a bi-dimensional matrix[N], how could I later, extract that numbers in a way that the 1st four numbers can be placed each on a variable?,
e.g int x1 = matrix , int y1 = matrix , int x2 = matrix, int y2 ;
so my problem is given that original bi-array assign x1,y1,x2,y2 to the 1st 4 numbers, then to the next 4 numbers,after that to the next 4 numbers, etc... I&#039;m working on c++.
1
2012-03-15T10:01:20-0400
As we understand you want to assign variables (x1 y1 , x2 y2) with every four consecutive numbers from bi-dimensional matrix[N]. Here is the
solution:

//code starts here
int x1;
int y1;

int x2;
int y2;
// loop which you are interested in
for (int i = 0; i < N; i += 2)
{
//first row
x1 = matrix[i];
y1 = matrix[i];
//second row
x2 = matrix[i+1];
y2 = matrix[i+1];
}
//code ends here

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!