Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- // ne menuvaj ovde
- void wf() {
- FILE *f = fopen("livce.txt", "w");
- char c;
- while((c = getchar()) != '#') {
- fputc(c, f);
- }
- fclose(f);
- }
- int main() {
- wf();
- // vasiot kod pocnuva od ovde
- FILE *a=fopen("livce.txt","r");
- int uplata;
- fscanf(a,"%d",&uplata);
- float dobivka=uplata;
- char sifra[9],maxsifra[9];
- int tip,maxtip;
- float koef,maxkoef=0;
- while(fscanf(a,"%s %d %f",sifra,&tip,&koef)!=EOF){
- if(koef>maxkoef){
- maxtip=tip;
- maxkoef=koef;
- for(int i=0;i<=strlen(sifra);i++){
- maxsifra[i]=sifra[i];
- }
- }
- dobivka*=koef;
- }
- printf("%s %d %.2f\n%.2f",maxsifra,maxtip,maxkoef,dobivka);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement