0
How to save input for 2d array data
i have 5 sets of data int a[] = { 18080, 18961, 18985, 18761, 17821, 19021, 18452, 20000 }; int b[] = { 4922, 4904, 4993, 5076, 4970, 4900, 4718, 4757 }; int c[] = { 13898, 14424, 14290, 14362, 12623, 13139, 13775, 15081 }; int d[] = { 7382, 7323, 7304, 7675, 7147, 7335, 6972, 7740 }; int e[] = { 1398, 1438, 1414, 1435, 1361, 1420, 1450, 1476 }; how do i store user input using 2D array to find the value I want to minus with a value that is not in the data
1 Réponse
0
int a[][] = {
{ 18080, 18961, 18985, 18761, 17821, 19021, 18452, 20000 },
{ 4922, 4904, 4993, 5076, 4970, 4900, 4718, 4757 },
{ 13898, 14424, 14290, 14362, 12623, 13139, 13775, 15081 },
{ 7382, 7323, 7304, 7675, 7147, 7335, 6972, 7740 },
{ 1398, 1438, 1414, 1435, 1361, 1420, 1450, 1476 }
};
// Two nested loops allow us to visit every spot in a 2D array.
// For every column I, visit every row J.
for (int i = 0; i < cols; i++) {
for (int j = 0; j < rows; j++) {
myArray[i][j] = 0;
}
}