Помогите написать программу, которая считает периметр двумерного массива, пожалуйста? (С++)
#include #include #include using namespace std; int main() { const int n = 3; const int m = 4; int a[n][m]; int s=0; cout << "Исходный массив" <<endl;<br>srand(time(0)); for (int i = 0; i < n; i++){ for (int j = 0; j < m; j++){ a[i][j]=10+(51.0 / RAND_MAX) * rand(); cout << fixed << setw (7) << a[i][j];<br> } cout <<endl;<br>} for (int j = 0; j < m; j++) s = s+a[0][j]+a[n-1][j]; for (int i = 1; i < n-1; i++) s = s+a[i][0]+a[i][m-1]; cout << "s = " << s << endl;<br>} Пример: Исходный массив 55 33 24 41 50 60 41 11 17 33 45 50 s = 359