#include <iostream>
#include <Windows.h>
using namespace std;
const int n = 4;
const int m = 4;
void enterArray(double[][m], int, int, char);
void printArray(double[][m], int, int, char);
void ArraySum(double[][m], int, int, char);
void changeArrayWithMin(double[][m], int, int, char);
int main() {
SetConsoleCP(1251);
SetConsoleOutputCP(1251);
double array[n][m];
char nameOfMatrix;
cout << "\n Введiть масив А(4,5):" << endl;
enterArray(array, 4, 5, 'A');
printArray(array, 4, 5, 'A');
ArraySum(array, 4, 5, 'B');
cout << endl;
cout << "\n Введiть масив B(5,3):" << endl;
enterArray(array, 5, 3, 'B');
printArray(array, 5, 3, 'B');
ArraySum(array, 5, 3, 'B');
cout << endl;
cout << "\n Введiть масив C(2,6):" << endl;
enterArray(array, 2, 6, 'C');
printArray(array, 2, 6, 'C');
ArraySum(array, 2, 6, 'B');
cout << endl;
return 0;
}
void enterArray(double array[][m], int n, int m, char nameOfMatrix) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
cout << nameOfMatrix << "[" << i << "][" << j << "] = ";
cin >> array[i][j];
}
}
cout << endl;
}
void printArray(double array[][m], int n, int m, char nameOfMatrix) {
for (int i = 0; i < n; i++)
{
for (int j = 0; j < m; j++)
{
cout << array[i][j] << " ";
}
cout << endl;
}
cout << endl;
}
void ArraySum(double array[][m], int n, int m, char nameOfMatrix)
{
for (int sum, i = 0; i <= n; i++)
{
sum = 0;
for (int j = 0; j <= m; j++)
{
if (array[j][i])
sum += array[j][i];
else
{
sum = 0;
break;
}
}
if (sum)
cout << "Сума элементiв " << i+1 << " стовбця = " << sum << endl;
}
}