#include <iostream>
#include <iomanip>
using namespace std;
constexpr size_t kMax(11);
void llenarMatriz(unsigned[][kMax]);
void mostrarMatriz(const unsigned[][kMax]);
void mostrarReloj(const unsigned[][kMax]);
int main() {
unsigned matriz[kMax][kMax] = { {0} };
llenarMatriz(matriz);
mostrarMatriz(matriz);
cout << '\n';
mostrarReloj(matriz);
return 0;
}
void llenarMatriz(unsigned matriz[][kMax]) {
for (size_t i(0); i < kMax; ++i) {
unsigned numero = i;
for (size_t j(0); j < kMax; ++j) {
matriz[i][j] = numero;
numero += 2;
}
}
}
void mostrarMatriz(const unsigned matriz[][kMax]) {
for (size_t i(0); i < kMax; ++i) {
for (size_t j(0); j < kMax; ++j) {
cout << setw(4) << matriz[i][j];
}
cout << '\n';
}
}
void mostrarReloj(const unsigned matriz[][kMax]) {
for (size_t i(0); i < kMax; ++i) {
if (i < kMax / 2) {
for (size_t espacios(0); espacios < i; ++espacios) {
cout << setw(4) << ' ';
}
for (size_t j(i); j < kMax - i; ++j) {
cout << setw(4) << matriz[i][j];
}
} else {
for (size_t espacios(kMax - 1 - i); espacios > 0; --espacios) {
cout << setw(4) << ' ';
}
for (size_t j(kMax - 1 - i); j <= i; ++j) {
cout << setw(4) << matriz[i][j];
}
}
cout << '\n';
}
}