I have problems with this function ... it turns out that when I execute it, it is printed on the screen directly: name > date > ... , and I can not capture the name.
I have the libraries <iostream>,<fstream>,<string> y <windows.h>
.If someone can explain me why this happens and how I could solve it.
thanks !!
void Menus::menuCarreras(){
int opcion;
while (opcion != 6){
cout<<"...SELECCIONAR OPCION..."<<endl;
cout<<"[1] -> AGREGAR CARRERA"<<endl;
cout<<"[2] -> BUSCAR CARRERA"<<endl;
cout<<"[3] -> ELIMINAR CARRERA"<<endl;
cout<<"[4] -> MODIFICAR CARRERA"<<endl;
cout<<"[5] -> MOSTRAR CARRERAS"<<endl;
cin>>opcion;
if(opcion == 1) {
string nNombre, nFecha;
float nInscripcion;
Carrera *nCarrera = new Carrera();
cout<<"nombre -> ";
getline(cin, nNombre);
nCarrera->setNomCarrera(nNombre);
cout<<"fecha -> ";
getline(cin, nFecha);
nCarrera->setFecha(nFecha);
cout<<"Inscripcion -> ";
cin>>nInscripcion;
nCarrera->setInscripcion(nInscripcion);
misCarreras->agregar(nCarrera); }
misCarreras->mostrar();
}
}