

matrices:


ejercicios:
#include <iostream>
#include <cstdlib>
using namespace std;
int A[4][4];
void ASIGNAR();
void MOSTRAR();
void PROMEDIO();
void SUMARMATRICES();
void MENORESCOMPLEMENTARIOS();
int main() {
int opcion = 0;
do {
cout << " M E N U P R I N C I P A L D E M A T R I C E S\n" << endl;
cout << " ----------------------------" << endl;
cout << " 1.- ASIGNAR VALORES A LA MATRIZ" << endl;
cout << " 2.- MOSTRAR LOS ELEMENTOS DE LA MATRIZ" << endl;
cout << " 3.- PROMEDIO DE LOS ELEMENTOS" << endl;
cout << " 4.- SUMA DE DOS MATRICES" << endl;
cout << " 5.- MENORES COMPLEMENTARIOS DE LA MATRIZ" << endl;
cout << " 0.- SALIR" << endl;
cout << endl;
cout << " INGRESE UNA OPCION <> 0 : ";
cin >> opcion;
cout << " ----------------------------" << endl;
switch (opcion) {
case 1:
ASIGNAR();
break;
case 2:
MOSTRAR();
break;
case 3:
PROMEDIO();
break;
case 4:
SUMARMATRICES();
break;
case 5:
MENORESCOMPLEMENTARIOS();
break;
}
} while (opcion != 0);
return 0;
}
void ASIGNAR() {
cout << "ASIGNANDO VALORES A LA MATRIZ A[4][4]" << endl;
cout << " ----------------------------" << endl;
for (int i = 0; i < 4; i++)
for (int j = 0; j < 4; j++)
A[i][j] = rand() % 10; // Rango de valores aleatorios: 0-9
}
void MOSTRAR() {
cout << "MOSTRANDO LOS ELEMENTOS DE LA MATRIZ A[4][4]" << endl;
cout << " ----------------------------" << endl;
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
cout << " A[" << i << "][" << j << "] = " << A[i][j] << endl;
}
}
}
void PROMEDIO() {
float sumar = 0;
cout << "PROMEDIO DE LOS ELEMENTOS DE LA MATRIZ A[4][4]" << endl;
cout << " ----------------------------" << endl;
for (int i = 0; i < 4; i++)
for (int j = 0; j < 4; j++)
sumar += A[i][j];
cout << "PROMEDIO DE LOS ELEMENTOS DE LA MATRIZ A[4][4] = " << sumar / 16 << endl;
}
void SUMARMATRICES() {
// Implementación de la suma de matrices similar al código original...
}
void MENORESCOMPLEMENTARIOS() {
cout << "CALCULANDO MENORES COMPLEMENTARIOS DE LA MATRIZ A[4][4]" << endl;
cout << " ----------------------------" << endl;
// Cálculo de menores complementarios de la matriz A