![Algoritmo que ingrese datos en una matriz](https://programacion.work/matrices/img/ingreso-matriz-en-pseint.png)
Matriz - Matrices - Vector Bidimensional
💻 Crear una matriz de 3 x 4, luego solicite por teclado el código, nombre, apellido y dirección de 3 alumnos y los visualice cargados en una matriz de la siguiente manera: Ejemplo.
Algoritmo programacion_work
Definir datos como Caracter;
Definir f, c como Entero;
Dimension datos[3,4];
//Lee Datos CODIGO, NOMBRE, APELLIDO, DIRECCIÓN
Para f <- 0 hasta 2 con paso 1 hacer
Escribir Sin Saltar "CODIGO : ";
Leer datos[f,0];
Escribir Sin Saltar "NOMBRE : ";
Leer datos[f,1];
Escribir Sin Saltar "APELLIDO : ";
Leer datos[f,2];
Escribir Sin Saltar "DIRECCIÓN : ";
Leer datos[f,3];
Escribir "";
FinPara
//Mostrar Datos
Escribir "CODIGO NOMBRE APELLIDO DIRECCIÓN";
Para f <- 0 hasta 2 con paso 1 hacer
Para c <- 0 hasta 3 con paso 1 hacer
Escribir Sin Saltar datos[f,c]," ";
FinPara
Escribir "";
FinPara
FinAlgoritmo
datos = [[str() for ind0 in range(4)] for ind1 in range(3)]
# Lee Datos CODIGO, NOMBRE, APELLIDO, DIRECCIÓN
for f in range(3):
datos[f][0] = input("CODIGO : ")
datos[f][1] = input("NOMBRE : ")
datos[f][2] = input("APELLIDO : ")
datos[f][3] = input("DIRECCIÓN : ")
print("")
# Mostrar Datos
print("CODIGO NOMBRE APELLIDO DIRECCIÓN")
for f in range(3):
for c in range(4):
print(datos[f][c],end=" ")
print()
#include<stdio.h>
#define MAX_STRLEN 256
int main() {
char datos[MAX_STRLEN][3][4];
/* Lee Datos CODIGO, NOMBRE, APELLIDO, DIRECCIÓN */
for (int f=0;f<=2;f++) {
printf("CODIGO : ");
gets(datos[f][0]);
printf("NOMBRE : ");
gets(datos[f][1]);
printf("APELLIDO : ");
gets(datos[f][2]);
printf("DIRECCION : ");
gets(datos[f][3]);
printf("\n");
}
/* Mostrar Datos */
printf("\nCODIGO NOMBRE APELLIDO DIRECCION\n");
for (int f=0;f<=2;f++){
for (int c=0;c<=3;c++){
printf("%s ",datos[f][c]);
}
printf("\n");
}
return 0;
}
#include<iostream>
using namespace std;
int main() {
string datos[3][4];
// Lee Datos CODIGO, NOMBRE, APELLIDO, DIRECCIÓN
for (int f=0;f<=2;f++) {
cout << "CODIGO : ";
cin >> datos[f][0];
cout << "NOMBRE : ";
cin >> datos[f][1];
cout << "APELLIDO : ";
cin >> datos[f][2];
cout << "DIRECCION : ";
cin >> datos[f][3];
cout << endl;
}
// Mostrar Datos
cout << "CODIGO NOMBRE APELLIDO DIRECCION" << endl;
for (int f=0;f<=2;f++) {
for (int c=0;c<=3;c++) {
cout << datos[f][c] << " ";
}
cout << endl;
}
return 0;
}