Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdlib.h>
- #include<stdio.h>
- #include<string.h>
- typedef struct{
- char p[30], zp[30];
- float cena;
- }Proizvod;
- float Taksa(Proizvod *x){
- if(strcmp("srbija", x->zp)!=0){
- x->cena=x->cena*1.05;
- return 1;
- }
- else return 0;
- }
- main(){
- FILE *in, *out;
- Proizvod p;
- in=fopen("proizvodi.txt", "r");
- out=fopen("izlaz.txt", "w");
- while(!feof(in)){
- fscanf(in, "%s %s %f", p.p, p.zp, &p.cena);
- if(Taksa(&p)!=0)
- fprintf(out, "%s\t%s\tcena sa taksnom: %.2f din\n", p.p, p.zp, p.cena);
- }
- fclose(in);
- fclose(out);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement