#include <stdio.h>
#include <stdlib.h>

struct datos {
    char nombre[50];
    float calif;
    struct datos *sig;
};

typedef struct datos ELEMENTO;

int main (){
    ELEMENTO *nodoinicial, *nodoanterior, *nuevonodo;
    float aux;
    char op='s';
    nodoinicial=NULL;
    do {
        nuevonodo=(ELEMENTO *)malloc(sizeof(ELEMENTO));
        printf("\nNombre del alumno: ");
        gets(nuevonodo->nombre);
        printf("Calificacion: ");
        scanf("%f",&aux);
        nuevonodo->calif=aux;
        nuevonodo->sig=NULL;
        if (nodoinicial == NULL) {
            nodoinicial=nuevonodo;
            nodoanterior=nuevonodo;
        }
        else {
            nodoanterior->sig=nuevonodo;
            nodoanterior=nuevonodo;
        }
        printf("\nDeseas ingresar los datos de otro alumno? (s/n): ");
        getchar();
        op = getchar();
        op = tolower(op);
        getchar();
    } while (op == 's');

    /*Impresion de informacion*/
    printf("\n");
    nuevonodo=nodoinicial;
    while(nuevonodo != NULL) {
        printf("\nNombre: %s", nuevonodo->nombre);
        printf("\nCalificacion: %.2f", nuevonodo->calif);
        nuevonodo=nuevonodo->sig;
        printf("\n");
    }
    printf("\n");
    getch();
    system("pausa");
}
