6 - Sexto (Pacientes)

download 6 - Sexto (Pacientes)

of 2

Transcript of 6 - Sexto (Pacientes)

  • 7/25/2019 6 - Sexto (Pacientes)

    1/2

    #include#include#include#include#include#define N 150

    typedef struct{ char nombres[20], fecha[12], alergico;

    float peso;} pacientes;

    int almacenar(pacientes p[N]){ char res; int n=0;

    do{ fflush(stdin);

    printf ("\n\t Paciente -%d-\n\n Nombres: ",n+1);gets(p[n].nombres);printf ("\n Peso (Kgs.): ");scanf("%f",&p[n].peso);fflush(stdin);printf ("\n Fecha de la %cltima visita (DD/MM/AA): ",163);gets(p[n].fecha);do

    { printf ("\n %cAl%crgico? (S/N): ",168,130);p[n].alergico=toupper(getche());} while (p[n].alergico!='S' && p[n].alergico!='N');do{ printf ("\n\n %cAlmacenar otro paciente? (S/N): ",168);

    res=toupper(getche());} while (res!='S' && res!='N');n++;system("cls");

    }while (res=='S');return n;

    }

    void buscar (pacientes p[N], char bnom[20], int n, int *pos){ int i;for (i=0;i

  • 7/25/2019 6 - Sexto (Pacientes)

    2/2

    if (pos==-1)printf ("\n Paciente no encontrado.\n\n ");

    elseprintf ("\n Fecha de la %cltima visita: %s\n Peso del paciente:

    %.1f Kg.\n\n ",163,pac[pos].fecha,pac[pos].peso);system("pause"); system("cls");printf ("\n PACIENTES CON ALERGIA Y CON PESO SUPERIOR A 70 KG.\n\n Nombr

    e\t|\tPeso(KG)\t|\tFecha\t|\tAl%crgico(S/N)",130);listar (pac, cant);getch();

    }