Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string.h>
- #include <stdio.h>
- #include <stdlib.h>
- int main () {
- FILE *in = fopen("BazaAut.txt", "r");
- FILE *out = fopen("Zabytki.txt", "w");
- char marka[30], model[30], przebieg[30], pojemnosc[30];
- int rocznik;
- while ( !feof(in) ) {
- fscanf(in, "%s", marka);
- fscanf(in, "%s", model);
- fscanf(in, "%s", przebieg);
- fscanf(in, "%s", pojemnosc);
- fscanf(in, "%d", &rocznik);
- printf("%s\n", marka);
- printf("%s\n", model);
- printf("%s\n", przebieg);
- printf("%s\n", pojemnosc);
- printf("%d\n", rocznik);
- if( rocznik < 1993 ) {
- //printf("stary\n");
- fprintf(out, "%s\n", marka);
- fprintf(out, "%s\n", model);
- fprintf(out, "%s\n", przebieg);
- fprintf(out, "%s\n", pojemnosc);
- fprintf(out, "%d\n", rocznik);
- }
- }
- fclose(in);
- fclose(out);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement