SHARE
TWEET

Untitled

a guest Aug 20th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main(){
  5.     FILE *f1;
  6.     FILE *f2;
  7.     if((f1=fopen("BazaAut.txt","r"))==NULL){
  8.         printf("BLAD");
  9.         exit(1);
  10.     }
  11.     if((f2=fopen("Zabytki.txt","w"))==NULL){
  12.         printf("BLAD");
  13.         exit(1);
  14.     }
  15.     int przebieg,pojemnosc,rocznik;
  16.     char marka[30],model[30];
  17.     while(!feof(f1)){
  18.         fscanf(f1,"%s",marka);
  19.         fscanf(f1,"%s",model);
  20.         fscanf(f1,"%i",&przebieg);
  21.         fscanf(f1,"%i",&pojemnosc);
  22.         fscanf(f1,"%i",&rocznik);
  23.         if((2018-rocznik)>25){
  24.             fprintf(f2,"%s\n",marka);
  25.             fprintf(f2,"%s\n",model);
  26.             fprintf(f2,"%i\n",przebieg);
  27.             fprintf(f2,"%i\n",pojemnosc);
  28.             fprintf(f2,"%i\n",rocznik);
  29.             fprintf(f2,"\n");
  30.         }
  31.     }
  32.     fclose(f1);
  33.     fclose(f2);
  34.    
  35.    
  36.     return 0;
  37. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top