Hello everyone, I'm trying to enter data into a 2d array, but I am not sure if I am doing it right. I have entered data into a single array before, but not two. I tried running break points, but I think I'm confusing myself even more. Here is my current code, does this correctly enter my data into a 2d array?
1 2 3 4 5 6 7 8 9 10 11 12 13 14
constint rows = 3;
constint columns = 4;
int my2dArray[rows][columns] = { 0, 0 };
for (int x = 0; x <= rows; x++)
{
for (int y = 0; y <= columns; y++)
{
while (my2dArray[x][y] != -1)
{
cin >> my2dArray[x][y];
}
}
}
Well, I wanted it to originally be if I entered x as -1 it would bolt me out of the loop. Also does this mean that my data is being properly entered into the 2d array?