#include
#include
int main() {
FILE *input = fopen("measles.txt","r");
char out_file[100];
printf("Please enter output file name:");
gets(out_file);
FILE *output = fopen(out_file, "w+");
char data[6200][200];
char a[6200][50+1];
char b[6200][6+1];
char cc[6200][3+1];
char d[6200][25+1];
char e[6200][4+1];
int c[6200];
int n = 0;
int con;
int i, j;
while (fgets(data[n], 200, input)) {
strncpy(a[n], data[n], 50);
strncpy(b[n], data[n] + 51, 6);
strncpy(cc[n], data[n] + 58, 3);
strncpy(d[n], data[n] + 62, 25);
strncpy(e[n], data[n] + 88, 4);
c[n] = 0;
for (i = 0; i < 3; i++)
if (data[n][i+58] != ' ')
c[n] = c[n] * 10 + data[n][i+58]-48;
a[n][50] = '\0';
b[n][6] = '\0';
cc[n][3] = '\0';
d[n][25] = '\0';
e[n][4] = '\0';
n++;
}
printf("Please enter the year:");
char year[10];
gets(year);
int flag = 0;
if (strstr(year, "all") != NULL strlen(year) == 3)
flag = 1;
if (strstr(year, "ALL") != NULL strlen(year) == 3)
flag = 1;
for (i = 0; i < n; i++) {
j = 0;
while (j < 4 j < strlen(year) e[i][j] == year[j])
j++;
if (j == strlen(year))
j = 1;
else
j = 0;
if (flag == 1 || j == 1)
fputs(data[i], output);
}
fclose(input);
fclose(output);
return 0;
}