- Dependerá a que es lo que llaman Vector y Matríz, lo normal es entender como Vector a un Array Unidimensional, y Matríz a un Array Multidimensional. Incluso dependiendo del Lenguaje de Programación, existen Clases pre-hechas de Vectores y Matrices ...
- Para entender a las Matrices más cómodamente se le suelen tratar como Objetos haciendo uso de sus Índices para que sean más legibles. Por ejemplo en Lenguaje C++:
Código
#include <iostream> using namespace std; const int DIAS = 2; const int TURNOS = 2; const int CLASES = 4; int main() { int lunes = 0, martes = 1; int manana = 0, tarde = 1; int clase = 0, hora = 1, salon = 2, profesor = 3; string horario[DIAS][TURNOS][CLASES]; string dias[] = {"Lunes", "Martes"}; string turnos[] = {"Manana", "Tarde"}; string datos[] = {"Clase", "Hora", "Salon", "Profesor"}; horario[lunes][manana][clase] = "Matematica"; horario[lunes][manana][hora] = "8:00 - 10:00"; horario[lunes][manana][salon] = "Salon 16"; horario[lunes][manana][profesor] = "Roberto Grego"; horario[lunes][tarde][clase] = "Estadistica"; horario[lunes][tarde][hora] = "02:00 - 04:00"; horario[lunes][tarde][salon] = "Salon 12"; horario[lunes][tarde][profesor] = "Ricardo Lira"; horario[martes][manana][clase] = "Algoritmos"; horario[martes][manana][hora] = "8:00 - 10:00"; horario[martes][manana][salon] = "Salon 10"; horario[martes][manana][profesor] = "Ana Patricia"; horario[martes][tarde][clase] = "TIC"; horario[martes][tarde][hora] = "02:00 - 04:00"; horario[martes][tarde][salon] = "Salon 6"; horario[martes][tarde][profesor] = "Carlos Lopez"; for ( int dia = 0; dia < DIAS; dia++ ) { cout << dias[dia] << endl; for ( int turno = 0; turno < TURNOS; turno++ ) { cout << "\t" << turnos[turno] << endl; cout << "\t\t" << datos[clase] << " :\t" << horario[dia][turno][clase] << endl; cout << "\t\t" << datos[hora] << " :\t" << horario[dia][turno][hora] << endl; cout << "\t\t" << datos[salon] << " :\t" << horario[dia][turno][salon] << endl; cout << "\t\t" << datos[profesor] << " : " << horario[dia][turno][profesor] << endl << endl; } } return 0; }
Código:
C:\Users\EdSon\Desktop>g++ matrices.cpp -o matrices.exe && matrices.exe
Lunes
Manana
Clase : Matematica
Hora : 8:00 - 10:00
Salon : Salon 16
Profesor : Roberto Grego
Tarde
Clase : Estadistica
Hora : 02:00 - 04:00
Salon : Salon 12
Profesor : Ricardo Lira
Martes
Manana
Clase : Algoritmos
Hora : 8:00 - 10:00
Salon : Salon 10
Profesor : Ana Patricia
Tarde
Clase : TIC
Hora : 02:00 - 04:00
Salon : Salon 6
Profesor : Carlos Lopez
C:\Users\EdSon\Desktop>