Exemplo n.º 1
0
int deleteProfesor(BaseDeDatos *bd, long int DNI){
    Profesor* profesor=buscarProfesor(bd,DNI);
    if (profesor!=NULL){
        profesor->persona.campoValido=0;
        return 0;
    }
    else{
        return 1;
    }
}
Exemplo n.º 2
0
int appendProfesor(BaseDeDatos *bd, Profesor *profesor){
    if (buscarProfesor(bd,profesor->persona.DNI)==NULL){
        struct ProfesorLista* nuevoProfesor=
               (struct ProfesorLista*) malloc(sizeof(struct ProfesorLista));
        nuevoProfesor->profesor=*profesor;
        nuevoProfesor->profesor.persona.campoValido=1;
        nuevoProfesor->profesorSiguiente=NULL;
        if (bd->profesorBD==NULL) bd->profesorBD=nuevoProfesor;
        else{
            struct ProfesorLista* ultimoProfesor = buscarUltimoProfesor(bd);
            ultimoProfesor->profesorSiguiente = nuevoProfesor;
        }
        return 0;
    }
    else{
        return 1;
    }
}
Exemplo n.º 3
0
int main()
{
    booleano continuaPrograma=VERDADERO;
    inicializarPrograma();
    do{
        switch(elegirOpcionMenu()){
            case ALTA:darDeAltaProfesor();break;
            case BAJA:darDeBajaProfesor();break;
            case CONSULTA:consultarProfesor();break;
            case CAMBIO:cambiarDatosDeProfesor();break;
            case LISTAR:listarProfesores();break;
            case BUSQUEDA:buscarProfesor();break;
            case SALIR:continuaPrograma=FALSO;break;
            default:printf("Opcion no valida!\n");
        }
        continuaPrograma?pausar():0;
    }while(continuaPrograma);
    return 0;
}
Exemplo n.º 4
0
Persona solicitarPersona(const BaseDeDatos* bd){
    Persona persona;
    system("CLS");
    printf("Introduzca el DNI: ");
    scanf("%ld",&persona.DNI);

    if (buscarProfesor(bd,persona.DNI)!=NULL ||buscarAlumno(bd,persona.DNI)!=NULL){
        printf("Ya hay una persona con este DNI\n");
        system("PAUSE");
        return;
    }
    printf("Introduzca el nombre: ");
    scanf(" %[^\n]",&persona.nombre);
    printf("Introduzca la dirección: ");
    scanf(" %[^\n]",&persona.direccion);
    printf("Introduzca el código postal: ");
    scanf("%d",&persona.codPostal);
    printf("Introduzca la ciudad: ");
    scanf(" %[^\n]",&persona.ciudad);
    persona.campoValido=1;
    return persona;
}