Persona.h
Código:
#ifndef persona_H
#define persona_H
#include <iostream>
#include <string>
using namespace std;
class Persona
{
public:
Persona();
bool asignarValores(string, string, string, char, int, int, int);
bool setID(string);
bool setApellidos(string);
bool setNombre(string);
bool setSexo(char);
bool setEdad(int);
bool setEstatura(int);
bool setPeso(int);
string getID();
string getApellidos();
string getNombre();
char getSexo();
int getEdad();
int getEstatura();
int getPeso();
bool validarSexo(char);
bool validarEdad(int);
bool validarEstatura(int);
bool validarPeso(int);
friend ostream& operator<<(ostream&, Persona);
private:
string id;
string apellidos;
string nombre;
char sexo;
int edad;
int estatura;
int peso;
};
#endif
#define persona_H
#include <iostream>
#include <string>
using namespace std;
class Persona
{
public:
Persona();
bool asignarValores(string, string, string, char, int, int, int);
bool setID(string);
bool setApellidos(string);
bool setNombre(string);
bool setSexo(char);
bool setEdad(int);
bool setEstatura(int);
bool setPeso(int);
string getID();
string getApellidos();
string getNombre();
char getSexo();
int getEdad();
int getEstatura();
int getPeso();
bool validarSexo(char);
bool validarEdad(int);
bool validarEstatura(int);
bool validarPeso(int);
friend ostream& operator<<(ostream&, Persona);
private:
string id;
string apellidos;
string nombre;
char sexo;
int edad;
int estatura;
int peso;
};
#endif
Persona.cpp
Código:
#include "persona.h"
#include <string>
Persona::Persona()
{
setID("Desconocido");
setApellidos("Desconocido");
setNombre("Desconocido");
setSexo('0');
setEdad(0);
setEstatura(0);
setPeso(0);
}
bool Persona :: asignarValores(string nid, string ap, string nom, char s, int e, int h, int w)
{
bool ok = false;
setID(nid);
setApellidos(ap);
setNombre(nom);
setSexo(s);
setEdad(e);
setEstatura(h);
setPeso(w);
ok = true;
return ok;
}
bool Persona :: setID(string nid)
{
id = nid;
return true;
}
bool Persona :: setApellidos(string ap)
{
apellidos = ap;
return true;
}
bool Persona :: setNombre(string nom)
{
nombre = nom;
return true;
}
bool Persona :: setSexo(char s)
{
bool ok = false;
if (validarSexo(s))
{
sexo = s;
ok = true;
}
return ok;
}
bool Persona :: setEdad(int e)
{
bool ok = false;
if(validarEdad(e))
{
edad = e;
ok = true;
}
return ok;
}
bool Persona :: setEstatura(int h)
{
bool ok = false;
if(validarEstatura(h))
{
estatura = h;
ok = true;
}
return ok;
}
bool Persona :: setPeso(int w)
{
bool ok = false;
if(validarPeso(w))
{
peso = w;
ok = true;
}
return ok;
}
string Persona :: getID()
{
return id;
}
string Persona :: getApellidos()
{
return apellidos;
}
string Persona :: getNombre()
{
return nombre;
}
char Persona :: getSexo()
{
return sexo;
}
int Persona :: getEdad()
{
return edad;
}
int Persona :: getEstatura()
{
return estatura;
}
int Persona :: getPeso()
{
return peso;
}
bool Persona :: validarSexo(char s)
{
bool ok = false;
if(s == 'M' || s == 'H' || s == 'O')
ok = true;
return ok;
}
bool Persona :: validarEdad(int e)
{
bool ok = false;
if(e >= 15 && e <= 100)
ok = true;
return ok;
}
bool Persona :: validarEstatura(int h)
{
bool ok = false;
if(h >= 30 && h <= 250)
ok = true;
return ok;
}
bool Persona :: validarPeso(int w)
{
bool ok = false;
if(w >= 25 && w <= 300)
ok = true;
return ok;
}
ostream& operator<<(ostream& out, Persona p)
{
out << p.getID() << ";";
out << p.getApellidos() << ";";
out << p.getNombre() << ";";
out << p.getSexo() << ";";
out << p.getEdad() << ";";
out << p.getEstatura() << ";";
out << p.getPeso() << endl << endl;
return out;
}
#include <string>
Persona::Persona()
{
setID("Desconocido");
setApellidos("Desconocido");
setNombre("Desconocido");
setSexo('0');
setEdad(0);
setEstatura(0);
setPeso(0);
}
bool Persona :: asignarValores(string nid, string ap, string nom, char s, int e, int h, int w)
{
bool ok = false;
setID(nid);
setApellidos(ap);
setNombre(nom);
setSexo(s);
setEdad(e);
setEstatura(h);
setPeso(w);
ok = true;
return ok;
}
bool Persona :: setID(string nid)
{
id = nid;
return true;
}
bool Persona :: setApellidos(string ap)
{
apellidos = ap;
return true;
}
bool Persona :: setNombre(string nom)
{
nombre = nom;
return true;
}
bool Persona :: setSexo(char s)
{
bool ok = false;
if (validarSexo(s))
{
sexo = s;
ok = true;
}
return ok;
}
bool Persona :: setEdad(int e)
{
bool ok = false;
if(validarEdad(e))
{
edad = e;
ok = true;
}
return ok;
}
bool Persona :: setEstatura(int h)
{
bool ok = false;
if(validarEstatura(h))
{
estatura = h;
ok = true;
}
return ok;
}
bool Persona :: setPeso(int w)
{
bool ok = false;
if(validarPeso(w))
{
peso = w;
ok = true;
}
return ok;
}
string Persona :: getID()
{
return id;
}
string Persona :: getApellidos()
{
return apellidos;
}
string Persona :: getNombre()
{
return nombre;
}
char Persona :: getSexo()
{
return sexo;
}
int Persona :: getEdad()
{
return edad;
}
int Persona :: getEstatura()
{
return estatura;
}
int Persona :: getPeso()
{
return peso;
}
bool Persona :: validarSexo(char s)
{
bool ok = false;
if(s == 'M' || s == 'H' || s == 'O')
ok = true;
return ok;
}
bool Persona :: validarEdad(int e)
{
bool ok = false;
if(e >= 15 && e <= 100)
ok = true;
return ok;
}
bool Persona :: validarEstatura(int h)
{
bool ok = false;
if(h >= 30 && h <= 250)
ok = true;
return ok;
}
bool Persona :: validarPeso(int w)
{
bool ok = false;
if(w >= 25 && w <= 300)
ok = true;
return ok;
}
ostream& operator<<(ostream& out, Persona p)
{
out << p.getID() << ";";
out << p.getApellidos() << ";";
out << p.getNombre() << ";";
out << p.getSexo() << ";";
out << p.getEdad() << ";";
out << p.getEstatura() << ";";
out << p.getPeso() << endl << endl;
return out;
}
Estudiante.h
Código:
#ifndef estudiante_H
#define estudiante_H
#include <iostream>
#include <string>
#include "persona.h"
using namespace std;
class Estudiante: public Persona
{
public:
Estudiante();
bool asignarValores(string, string, string, char, int, int, int, string, int);
bool setTitulacion(string);
bool setCurso(int);
bool setID(string);
string getTitulacion();
int getCurso();
friend ostream& operator<<(ostream&, Estudiante);
private:
string titulacion;
int curso;
bool validarID(string);
bool validarCurso(int);
};
#endif
#define estudiante_H
#include <iostream>
#include <string>
#include "persona.h"
using namespace std;
class Estudiante: public Persona
{
public:
Estudiante();
bool asignarValores(string, string, string, char, int, int, int, string, int);
bool setTitulacion(string);
bool setCurso(int);
bool setID(string);
string getTitulacion();
int getCurso();
friend ostream& operator<<(ostream&, Estudiante);
private:
string titulacion;
int curso;
bool validarID(string);
bool validarCurso(int);
};
#endif
Estudiante.cpp
Código:
#include "persona.h"
#include "estudiante.h"
#include <string>
Estudiante :: Estudiante()
{
setID("Desconocido");
setApellidos("Desconocido");
setNombre("Desconocido");
setSexo('0');
setEdad(0);
setEstatura(0);
setPeso(0);
setTitulacion("Desconocido");
setCurso(0);
}
bool Estudiante :: asignarValores (string id2, string ap, string nom, char s, int a, int h, int w, string tit, int c)
{
bool ok = false;
setID(id2);
setApellidos(ap);
setNombre(nom);
setSexo(s);
setEdad(a);
setEstatura(h);
setPeso(w);
setTitulacion(tit);
setCurso(c);
ok = true;
return ok;
}
bool Estudiante :: setTitulacion(string tit)
{
titulacion = tit;
return true;
}
bool Estudiante :: setCurso(int c)
{
bool ok = false;
if (validarCurso(c))
{
setCurso(c);
ok = true;
}
return ok;
}
bool Estudiante :: setID(string id2)
{
bool ok = false;
if (validarID(id2))
{
Persona::setID(id2);
ok = true;
}
return ok;
}
string Estudiante :: getTitulacion()
{
return titulacion;
}
int Estudiante :: getCurso()
{
return curso;
}
ostream& operator<<(ostream& out, Estudiante e)
{
out << e.getID() << ";";
out << e.getApellidos() << ";";
out << e.getNombre() << ";";
out << e.getSexo() << ";";
out << e.getEdad() << ";";
out << e.getEstatura() << ";";
out << e.getPeso() << ";";
out << e.getTitulacion() << ";" << e.getCurso() << endl << endl;
return out;
}
bool Estudiante :: validarID(string id2)
{
bool ok = false;
if (id2[0] >= 'A' && id2[0] <= 'Z' && id2[1] >= 'A' && id2[1] <= 'Z')
ok = true;
return ok;
}
bool Estudiante :: validarCurso(int c)
{
bool ok = false;
if(c <= 4 && c >= 1)
ok = true;
return ok;
}
#include "estudiante.h"
#include <string>
Estudiante :: Estudiante()
{
setID("Desconocido");
setApellidos("Desconocido");
setNombre("Desconocido");
setSexo('0');
setEdad(0);
setEstatura(0);
setPeso(0);
setTitulacion("Desconocido");
setCurso(0);
}
bool Estudiante :: asignarValores (string id2, string ap, string nom, char s, int a, int h, int w, string tit, int c)
{
bool ok = false;
setID(id2);
setApellidos(ap);
setNombre(nom);
setSexo(s);
setEdad(a);
setEstatura(h);
setPeso(w);
setTitulacion(tit);
setCurso(c);
ok = true;
return ok;
}
bool Estudiante :: setTitulacion(string tit)
{
titulacion = tit;
return true;
}
bool Estudiante :: setCurso(int c)
{
bool ok = false;
if (validarCurso(c))
{
setCurso(c);
ok = true;
}
return ok;
}
bool Estudiante :: setID(string id2)
{
bool ok = false;
if (validarID(id2))
{
Persona::setID(id2);
ok = true;
}
return ok;
}
string Estudiante :: getTitulacion()
{
return titulacion;
}
int Estudiante :: getCurso()
{
return curso;
}
ostream& operator<<(ostream& out, Estudiante e)
{
out << e.getID() << ";";
out << e.getApellidos() << ";";
out << e.getNombre() << ";";
out << e.getSexo() << ";";
out << e.getEdad() << ";";
out << e.getEstatura() << ";";
out << e.getPeso() << ";";
out << e.getTitulacion() << ";" << e.getCurso() << endl << endl;
return out;
}
bool Estudiante :: validarID(string id2)
{
bool ok = false;
if (id2[0] >= 'A' && id2[0] <= 'Z' && id2[1] >= 'A' && id2[1] <= 'Z')
ok = true;
return ok;
}
bool Estudiante :: validarCurso(int c)
{
bool ok = false;
if(c <= 4 && c >= 1)
ok = true;
return ok;
}
main.cpp
Código:
#include <iostream>
#include <fstream>
#include <vector>
#include "estudiante.h"
using namespace std;
/*
* Prototipos de las funciones empleadas,
* implementadas despues de main()
*/
string ExtraerToken(string&);
bool StrToestudiante (string, Estudiante&);
vector<Estudiante> LeerFichero(string);
Estudiante MasAlto (vector<Estudiante>);
Estudiante MasBajo (vector<Estudiante>);
Estudiante MasJoven (vector<Estudiante>);
Estudiante MasViejo (vector<Estudiante>);
unsigned int NumEstudiantesCurso (vector<Estudiante>, int c);
/*
* Programa principal
*/
int main ()
{
const string NOMBRE = "personal.dat"; //Nombre del archivo de datos
vector<Estudiante> misestudiantes; //Vector para almacenar estudiantes leidos
cout << endl << "Leyendo archivo ... ";
misestudiantes = LeerFichero(NOMBRE);
cout << "Fin." << endl;
cout << endl;
cout << "*** Num. estudiantes correctamente leidos: " << misestudiantes.size() << " ***" << endl;
cout << endl;
cout << "1. Estudiante mas ALTO:" << endl;
cout << MasAlto(misestudiantes) << endl;
cout << endl;
cout << "2. Estudiante mas BAJO:" << endl;
cout << MasBajo(misestudiantes) << endl;
cout << endl;
cout << "3. Estudiante mas JOVEN:" << endl;
cout << MasJoven(misestudiantes) << endl;
cout << endl;
cout << "4. Estudiante mas VIEJO:" << endl;
cout << MasViejo(misestudiantes) << endl;
cout << endl;
cout << "5. Estudiantes por curso:" << endl;
for (unsigned int i = 1; i <= 4; i++)
cout << "\tCurso " << i << " = " << NumEstudiantesCurso(misestudiantes,i) << endl;
return 0;
}
/**********************************************************************/ /**
*
* Extraer 1 token de información de la cadena separada por ';'
* El token es eliminado de la cadena de entrada
*
* @param [in,out] s Cadena de datos
*
* @return string con el token extraido
*
*/ /**********************************************************************/
string ExtraerToken(string & s)
{
string res="";
size_t pos;
pos = s.find(";");
if ( pos != string::npos )
{
res = s.substr(0,pos);
s.erase(0,pos+1);
}
else
{
res = s;
s = "";
}
return res;
}
/**********************************************************************/ /**
*
* Asignar valores a un objeto Estudiante a partir de
* una línea de texto con datos separados por ';'
*
* @param [in] texto Linea de texto
* @param [in,out] est Estudiante modificado
*
* @retval true Ha sido posible asignar correctamente valores.
* @retval false No ha sido posible asignar correctamente valores.
*
*/ /**********************************************************************/
bool StrToEstudiante (string texto, Estudiante& est)
{
string dato;
unsigned int campo;
string id, a, n;
char s;
int e, h, w;
string tit;
int curs;
bool ok = true;
campo = 0;
while ( ok && campo < 9 )
{
dato = ExtraerToken(texto);
if ( dato.length() != 0 )
{
switch ( campo )
{
case 0: id = dato; break;
case 1: a = dato; break;
case 2: n = dato; break;
case 3: s = dato[0]; break;
case 4: e = stoi(dato); break;
case 5: h = stoi(dato); break;
case 6: w = stoi(dato); break;
case 7: tit = dato; break;
case 8:
curs = stoi(dato);
ok = est.asignarValores(id,a,n,s,e,h,w,tit,curs);
break;
}
campo++;
}
else
ok = false;
}
return ok;
}
/**********************************************************************/ /**
*
* Leer fichero de datos, devuelve vector de Estudiantes
*
* @param [in] nom Nombre del fichero
*
* @return vector de Estudiantes
*
*/ /**********************************************************************/
vector<Estudiante> LeerFichero(string nom)
{
ifstream fich_in;
vector<Estudiante> v;
string linea;
fich_in.open (nom);
if (fich_in)
{
while ( getline(fich_in, linea) )
{
Estudiante e;
if ( StrToEstudiante(linea,e) )
v.push_back(e);
}
fich_in.close ();
}
else
cerr << "LeerFichero: Error al abrir el archivo de datos." << endl;
return v;
}
/**********************************************************************/ /**
*
* Determina el estudiante más alto de un vector de Estudiantes
*
* @param [in] v Vector de Estudiantes
*
* @return Estudiante de mayor estatura (el primero del vector)
*
*/ /**********************************************************************/
Estudiante MasAlto (vector<Estudiante> v)
{
unsigned int max;
Estudiante e;
if ( v.size() > 0 )
{
max = 0;
for (unsigned int i=0; i < v.size(); i++)
if (v[i].getEstatura() > v[max].getEstatura())
max = i;
e = v[max];
}
return e;
}
/**********************************************************************/ /**
*
* Determina el estudiante más bajo de un vector de Estudiantes
*
* @param [in] v Vector de Estudiantes
*
* @return Estudiante de menor estatura (el primero del vector)
*
*/ /**********************************************************************/
Estudiante MasBajo (vector<Estudiante> v)
{
unsigned int min;
Estudiante e;
if ( v.size() > 0 )
{
min = 0;
for (unsigned int i=0; i < v.size(); i++)
if (v[i].getEstatura() < v[min].getEstatura())
min = i;
e = v[min];
}
return e;
}
/**********************************************************************/ /**
*
* Determina el estudiante más joven de un vector de Estudiantes
*
* @param [in] v Vector de Estudiantes
*
* @return Estudiante de menor edad (el primero del vector)
*
*/ /**********************************************************************/
Estudiante MasJoven (vector<Estudiante> v)
{
unsigned int min;
Estudiante e;
if ( v.size() > 0 )
{
min = 0;
for (unsigned int i=0; i < v.size(); i++)
if (v[i].getEdad() < v[min].getEdad())
min = i;
e = v[min];
}
return e;
}
/**********************************************************************/ /**
*
* Determina el estudiante más viejo de un vector de Estudiantes
*
* @param [in] v Vector de Estudiantes
*
* @return Estudiante de mayor edad (el primero del vector)
*
*/ /**********************************************************************/
Estudiante MasViejo (vector<Estudiante> v)
{
unsigned int max;
Estudiante e;
if ( v.size() > 0 )
{
max = 0;
for (unsigned int i=0; i < v.size(); i++)
if (v[i].getEdad() > v[max].getEdad())
max = i;
e = v[max];
}
return e;
}
/**********************************************************************/ /**
*
* Determina el nº de estudiantes de un curso de un vector de Estudiantes
*
* @param [in] v Vector de Estudiantes
* @param [in] c Curso a buscar
*
* @return número de estudiantes en el curso c
*
*/ /**********************************************************************/
unsigned int NumEstudiantesCurso (vector<Estudiante> v, int c)
{
unsigned int num = 0;
for (unsigned int i=0; i < v.size(); i++)
if ( v[i].getCurso() == c )
num++;
return num;
}
#include <fstream>
#include <vector>
#include "estudiante.h"
using namespace std;
/*
* Prototipos de las funciones empleadas,
* implementadas despues de main()
*/
string ExtraerToken(string&);
bool StrToestudiante (string, Estudiante&);
vector<Estudiante> LeerFichero(string);
Estudiante MasAlto (vector<Estudiante>);
Estudiante MasBajo (vector<Estudiante>);
Estudiante MasJoven (vector<Estudiante>);
Estudiante MasViejo (vector<Estudiante>);
unsigned int NumEstudiantesCurso (vector<Estudiante>, int c);
/*
* Programa principal
*/
int main ()
{
const string NOMBRE = "personal.dat"; //Nombre del archivo de datos
vector<Estudiante> misestudiantes; //Vector para almacenar estudiantes leidos
cout << endl << "Leyendo archivo ... ";
misestudiantes = LeerFichero(NOMBRE);
cout << "Fin." << endl;
cout << endl;
cout << "*** Num. estudiantes correctamente leidos: " << misestudiantes.size() << " ***" << endl;
cout << endl;
cout << "1. Estudiante mas ALTO:" << endl;
cout << MasAlto(misestudiantes) << endl;
cout << endl;
cout << "2. Estudiante mas BAJO:" << endl;
cout << MasBajo(misestudiantes) << endl;
cout << endl;
cout << "3. Estudiante mas JOVEN:" << endl;
cout << MasJoven(misestudiantes) << endl;
cout << endl;
cout << "4. Estudiante mas VIEJO:" << endl;
cout << MasViejo(misestudiantes) << endl;
cout << endl;
cout << "5. Estudiantes por curso:" << endl;
for (unsigned int i = 1; i <= 4; i++)
cout << "\tCurso " << i << " = " << NumEstudiantesCurso(misestudiantes,i) << endl;
return 0;
}
/**********************************************************************/ /**
*
* Extraer 1 token de información de la cadena separada por ';'
* El token es eliminado de la cadena de entrada
*
* @param [in,out] s Cadena de datos
*
* @return string con el token extraido
*
*/ /**********************************************************************/
string ExtraerToken(string & s)
{
string res="";
size_t pos;
pos = s.find(";");
if ( pos != string::npos )
{
res = s.substr(0,pos);
s.erase(0,pos+1);
}
else
{
res = s;
s = "";
}
return res;
}
/**********************************************************************/ /**
*
* Asignar valores a un objeto Estudiante a partir de
* una línea de texto con datos separados por ';'
*
* @param [in] texto Linea de texto
* @param [in,out] est Estudiante modificado
*
* @retval true Ha sido posible asignar correctamente valores.
* @retval false No ha sido posible asignar correctamente valores.
*
*/ /**********************************************************************/
bool StrToEstudiante (string texto, Estudiante& est)
{
string dato;
unsigned int campo;
string id, a, n;
char s;
int e, h, w;
string tit;
int curs;
bool ok = true;
campo = 0;
while ( ok && campo < 9 )
{
dato = ExtraerToken(texto);
if ( dato.length() != 0 )
{
switch ( campo )
{
case 0: id = dato; break;
case 1: a = dato; break;
case 2: n = dato; break;
case 3: s = dato[0]; break;
case 4: e = stoi(dato); break;
case 5: h = stoi(dato); break;
case 6: w = stoi(dato); break;
case 7: tit = dato; break;
case 8:
curs = stoi(dato);
ok = est.asignarValores(id,a,n,s,e,h,w,tit,curs);
break;
}
campo++;
}
else
ok = false;
}
return ok;
}
/**********************************************************************/ /**
*
* Leer fichero de datos, devuelve vector de Estudiantes
*
* @param [in] nom Nombre del fichero
*
* @return vector de Estudiantes
*
*/ /**********************************************************************/
vector<Estudiante> LeerFichero(string nom)
{
ifstream fich_in;
vector<Estudiante> v;
string linea;
fich_in.open (nom);
if (fich_in)
{
while ( getline(fich_in, linea) )
{
Estudiante e;
if ( StrToEstudiante(linea,e) )
v.push_back(e);
}
fich_in.close ();
}
else
cerr << "LeerFichero: Error al abrir el archivo de datos." << endl;
return v;
}
/**********************************************************************/ /**
*
* Determina el estudiante más alto de un vector de Estudiantes
*
* @param [in] v Vector de Estudiantes
*
* @return Estudiante de mayor estatura (el primero del vector)
*
*/ /**********************************************************************/
Estudiante MasAlto (vector<Estudiante> v)
{
unsigned int max;
Estudiante e;
if ( v.size() > 0 )
{
max = 0;
for (unsigned int i=0; i < v.size(); i++)
if (v[i].getEstatura() > v[max].getEstatura())
max = i;
e = v[max];
}
return e;
}
/**********************************************************************/ /**
*
* Determina el estudiante más bajo de un vector de Estudiantes
*
* @param [in] v Vector de Estudiantes
*
* @return Estudiante de menor estatura (el primero del vector)
*
*/ /**********************************************************************/
Estudiante MasBajo (vector<Estudiante> v)
{
unsigned int min;
Estudiante e;
if ( v.size() > 0 )
{
min = 0;
for (unsigned int i=0; i < v.size(); i++)
if (v[i].getEstatura() < v[min].getEstatura())
min = i;
e = v[min];
}
return e;
}
/**********************************************************************/ /**
*
* Determina el estudiante más joven de un vector de Estudiantes
*
* @param [in] v Vector de Estudiantes
*
* @return Estudiante de menor edad (el primero del vector)
*
*/ /**********************************************************************/
Estudiante MasJoven (vector<Estudiante> v)
{
unsigned int min;
Estudiante e;
if ( v.size() > 0 )
{
min = 0;
for (unsigned int i=0; i < v.size(); i++)
if (v[i].getEdad() < v[min].getEdad())
min = i;
e = v[min];
}
return e;
}
/**********************************************************************/ /**
*
* Determina el estudiante más viejo de un vector de Estudiantes
*
* @param [in] v Vector de Estudiantes
*
* @return Estudiante de mayor edad (el primero del vector)
*
*/ /**********************************************************************/
Estudiante MasViejo (vector<Estudiante> v)
{
unsigned int max;
Estudiante e;
if ( v.size() > 0 )
{
max = 0;
for (unsigned int i=0; i < v.size(); i++)
if (v[i].getEdad() > v[max].getEdad())
max = i;
e = v[max];
}
return e;
}
/**********************************************************************/ /**
*
* Determina el nº de estudiantes de un curso de un vector de Estudiantes
*
* @param [in] v Vector de Estudiantes
* @param [in] c Curso a buscar
*
* @return número de estudiantes en el curso c
*
*/ /**********************************************************************/
unsigned int NumEstudiantesCurso (vector<Estudiante> v, int c)
{
unsigned int num = 0;
for (unsigned int i=0; i < v.size(); i++)
if ( v[i].getCurso() == c )
num++;
return num;
}