Advertisement
Guest User

asadad

a guest
Apr 17th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.54 KB | None | 0 0
  1. #include<stdlib.h>
  2. #include<stdio.h>
  3. #include<string.h>
  4. typedef struct{
  5.     char p[30], zp[30];
  6.     float cena;
  7. }Proizvod;
  8. float Taksa(Proizvod *x){
  9.     if(strcmp("srbija", x->zp)!=0){
  10.         x->cena=x->cena*1.05;
  11.         return 1;
  12.     }
  13.     else return 0;
  14. }
  15. main(){
  16.     FILE *in, *out;
  17.     Proizvod p;
  18.     in=fopen("proizvodi.txt", "r");
  19.     out=fopen("izlaz.txt", "w");
  20.     while(!feof(in)){
  21.         fscanf(in, "%s %s %f", p.p, p.zp, &p.cena);
  22.         if(Taksa(&p)!=0)
  23.             fprintf(out, "%s\t%s\tcena sa taksnom: %.2f din\n", p.p, p.zp, p.cena);
  24.     }
  25.     fclose(in);
  26.     fclose(out);
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement