int main()
{
SetConsoleOutputCP(1251);
int const r = 4;
int const c = 4;
int w[r][c] = {
{1, 3, -8, 0},
{-4, 6, 2, -5},
{3, 7, 0, 6},
{-3, 9, 11, -2} };
int i{}, j{};
cout << "Поточна матриця\n";
for (i = 0; i < r; i++)
{
for (j = 0; j < c; j++) cout << w[i][j] << "\t ";
cout << "\n";
}
cout << " \n";//+
cout << "Перетворена матриця\n";
for (i = 0; i < r; i++)
{
for (j = 0; j < c; j++)
{
if (w[i][j]>0 && w[i][j] < 6)
{
w[i][j] = 0;
cout << w[i][j] << "\t ";
}
}
cout << "\n";
}
}
#include<iostream>
#include<clocale>
#include<iomanip>
using namespace std;
#define COLS 4
int main(int argc, char** argv)
{
setlocale(LC_ALL, "Ukrainian");
int w[][COLS] = {
{1, 3, -8, 0},
{-4, 6, 2, -5},
{3, 7, 0, 6},
{-3, 9, 11, -2}
};
cout << "Поточна матриця\n";
for (int i{0}; i < COLS; ++i)
{
for (int j{0}; j < COLS; ++j)
cout<< showpos <<w[i][j]<< setw(5);
cout << '\n';
}
cout << "\nПеретворена матриця\n";
for (int i{0}; i < COLS; ++i)
{
for (int j{0}; j < COLS; ++j)
{
if (w[i][j]>0 && w[i][j] < 6)
w[i][j] = 0;
cout<< showpos <<w[i][j]<< setw(5);
}
cout << '\n';
}
return 0;
}