Раз в выводе присутствует нулевой индекс, то это точно не Pascal!
#include
using namespace std;
int main() {
const size_t size = 4;
short matrix[size][size] = {{1,1,2,2},{3,3,4,4},{5,5,6,6},{9,9,7,7}};
for (unsigned r = 0; r < size; r++, cout << endl)
for (unsigned c = 0; c < size; c++)
cout << ' ' << matrix[r][c];
short max = SHRT_MIN, sum;
size_t ir = 0, ic = 0;
for (unsigned r = 1; r < size; r++)
for (unsigned c = 1; c < size; c++) {
sum = matrix[r][c] + matrix[r][c - 1] + matrix[r - 1][c] + matrix[r - 1][c - 1];
if (sum > max) {
max = sum;
ir = r - 1;
ic = c - 1;
}
}
cout << "\n Output: " << ir << ' ' << ic << ' ' << max << endl;
cin.get();
return 0;
}