daily pastebin goal
67%
SHARE
TWEET

asadad

a guest Apr 17th, 2018 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
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