All pastes #18591 Raw Edit

Mine

public text v1 · immutable
#18591 ·published 2005-07-27 05:44 UTC
rendered paste body
#include <stdio.h>

int main() {
FILE *database;

        struct person {
        char name[80];
        int age;
        char sex;
        int month;
        int day;
        int year;

        }person[10];

int i;

        for(i=0;i<=9;i++) {
                printf("Enter the persons Name: ");
                scanf("%s",&(person[i].name));
                printf("Enter the person's Age: ");
                scanf("%d",&(person[i].age));
                printf("Enter the person's Sex (M or F): ");
                scanf("%c",&(person[i].sex));
                printf("Enter the person's Birth Date (DD/MM/YYYY): ");
                scanf("%d/%d/%d",&(person[i].day),&(person[i].month),&(person[i].year));
        }
	
	database=fopen("database.dat","wb");
        fwrite(person,sizeof(struct person),10,database);
return(0);	
}