Está en la página 1de 2

#include<iostream>

#include<stdlib.h>
#include<string>
using namespace std;
struct ficha {
string codigo;
string paterno;
string nombre;
string curso;
int nota;
};

void main() {
ficha boletin[100];
int N;
cout << "Ingrese el numero de estudiantes "; cin >> N;
for (int i = 1; i <= N; i++) {
cin.ignore();
cout << "Ingrese el codigo ";
getline(cin, boletin[i].codigo);
cout << "Ingrese el Apellido Paterno ";
getline(cin, boletin[i].paterno);
cout << "Ingrese el Nombre ";
getline(cin, boletin[i].nombre);
cout << "Ingrese el Curso ";
getline(cin, boletin[i].curso);
cout << "Ingrese la nota ";
cin >> boletin[i].nota;
cout << '\n';
}
}

#include<iostream>
#include<stdlib.h>
#include<string>

using namespace std;


struct ficha {
string nombre;
int edad;
string curso;
int nota;
};
void main() {
ficha boletin;
cout << "Ingrese nombre ";
getline(cin, boletin.nombre);
cout << "Ingrese la edad ";
cin >> boletin.edad;
cout << "Ingrese el curso "; cin.ignore();
getline(cin, boletin.curso);
cout << "Ingrese nota del curso ";
cin >> boletin.nota;
cout << endl << endl;
cout << "El alumno de nombre " << boletin.nombre << endl
<< "edad " << boletin.edad << endl
<< "Y el curso " << boletin.curso << endl
<< "Tiene por nota " << boletin.nota << endl;
system("pause");
}

MATRICES-Sistemas dinamicos-punteros-null-etc
MATRICES DINAMICAS:

#include <iostream>
#include<stdlib.h>
using namespace std;
int** pntMa; //significa que es un puntero de puntero
int nF,nC; //variables globales

void main() {
cout << "Ingrese las filas ";
cin >> nF;
cout << "Ingrese las columnas "; cin >> nC;

pntMa = new int * [nF];//PRIMER PUNTERO


for (int i = 0; i < nF; i++)
pntMa[i] = new int[nC];
////////////////////////////////////////////
cout << "Ingresando Datos ";
for (int i = 0; i < nF; i++)
for (int j = 0; j < nC; j++)
cin >> *(*(pntMa + i) + j); //cin>>pntMa[i][j];

cout << "Escribiendo la Matriz "<<endl;


for (int i = 0; i < nF; i++) {
for (int j = 0; j < nC; j++) {
cout << (*(*(pntMa + i) + j)) << ' ';
//cout<< pntMa[i][j] << ' ';
}
cout << endl;
}
//Liberando Memoria
for (int i = 0; i < nF; i++)
delete[] pntMa[i];
delete[] pntMa;
system("pause");
}

También podría gustarte