#include <stdio.h>

int main(void) {
    int aantal = 0;
    int teller;

    struct {
        char naam[21];
        char adres[26];
        int leeftijd;
        int salaris;
    } rij[20];

    /* Invoer */
    do {
        printf("Hoeveel personen wilt u invoeren? (max 20) ");
        fflush(stdin);
    }
    while (scanf("%d", &aantal) != 1 || aantal < 1 || aantal > 20);

    for (teller = 0; teller < aantal; ++teller) {
        do {
            printf("Invoer persoon %d    Naam    : ", teller);
            fflush(stdin);
        } while (scanf("%20[A-Za-z.@+()\- ]", rij[teller].naam) != 1);
        do {
            printf("                    Adres   : ");
            fflush(stdin);
        } while (scanf("%25[A-Za-z0-9.,?:/()\- ]", rij[teller].adres) != 1);
        do {
            printf("                    Leeftijd: ");
            fflush(stdin);
        } while (scanf("%d", &rij[teller].leeftijd) != 1);
        do {
            printf("                    Salaris : ");
            fflush(stdin);
        } while (scanf("%d", &rij[teller].salaris) != 1);
    }

    /* Uitvoer */
    printf("\n");
    printf("%2s | %-20s | %-25s | %5s | %8s\n", "Nr", "Naam", "Adres", "Lft", "Sal");
    for (teller = 0; teller < aantal; ++teller) {
        printf(
            "%02d | %-20s | %-25s | %5d | %8d\n",
            teller,
            rij[teller].naam,
            rij[teller].adres,
            rij[teller].leeftijd,
            rij[teller].salaris
        );
    }
    fflush(stdin);
    getchar();
    return 0;
}
