Code:
#include<stdlib.h>
#include<string.h>
#define TSIZE 50
struct Medico
{
int Id_Doc[TSIZE];
char Nombre[TSIZE];
char Especialidad[TSIZE];
char Estado[TSIZE];
struct Medico*next;
};
int main(void)
{
struct Medico * head = NULL;
struct Medico * prev, * current;
char input[TSIZE];
puts("Que tal nuevo usuario, porfavor dame tu nombre ");
while (gets(input) != NULL && input[0] != '\0')
{
current = (struct Medico *) malloc(sizeof(struct Medico));
if (head == NULL)
head = current;
else
prev->next = NULL;
strcpy(current->Nombre, input);
puts("Dame tu Especialidad");
scanf("%d", ¤t->Especialidad);
while(getchar() != '\n')
continue;
puts("Quiere registrar a alguien mas? En ese caso deme su nombre, si no dejar en blanco y presionar enter");
prev=current;
}
if(head==NULL)
printf("No data entered. ");
current = head;
while(current!=NULL)
{
printf("Doctor: %s Especialidad: %s ", current->Nombre, current->Especialidad);
current=current->next;
}
current=head;
while (current !=NULL)
{
free(current);
current=current->next;
}
printf("Bye!\n");
return 0;
}
Thats the code I've got so far just to ask Name and Specialty for a doctor(for example)
Id_Doc = accnum
nombre=name
especialidad=specialty
estado=status
So im just asking for name and specialty, how could I make the terminal ask for the rest of the arguments...?