第1个回答 2012-10-29
int nArray[4][6] = {0};
int nMin = 0;
for (int i = 0; i<4; ++i) {
for (int j = 0; j<6; ++j) {
scanf("%d", &nArray[i][j]);
if ((!i && !j) || nMin>nArray[i][j]) {
nMin = nArray[i][j];
}
}
}
printf("The min intiger is : %d", nMin);
for (int i = 0; i<4; ++i) {
for (int j = 0; j<6; ++j) {
if (nArray[i][j] == nMin) {
printf("The min index is : [%d][%d]", i, j);
}
}
}
鉴于最小元素可能不只一个,所以采用循环输出