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 *f = fopen("livce.txt", "r");
- int tip, maxTip, uplata;
- char sifra[15], maxSifra[15];
- float koef, maxKoef = 0, total;
- fscanf(f, "%d", &uplata);
- total = uplata;
- while ((fscanf(f,"%s %d %f", &sifra, &tip, &koef)) != EOF){
- total *= koef;
- if (koef > maxKoef){
- maxKoef = koef;
- maxTip = tip;
- strcpy(maxSifra, sifra);
- }
- }
- printf("%s %d %.2f\n", maxSifra, maxTip, maxKoef);
- printf("%.2f", total);
- fclose(f);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement