// polow.cpp : Defines the entry point for the console application. // #define _CRT_SECURE_NO_DEPRECATE #include "stdafx.h" #include #include #include #include #include struct struct_ryby { char gatunek [20]; float ilosc; }; int _tmain(int argc, _TCHAR* argv[]) { float c=0; int i=0; int z=0; int wynik; struct_ryby Ryby[100]; FILE *wczytaj; FILE *zapisz; wczytaj = fopen ("wpolow.txt","r"); if (NULL==wczytaj) { perror ("blad"); exit (1); } while (!feof (wczytaj)) { fscanf (wczytaj, "%s %f.5", &Ryby[i].gatunek, &Ryby[i].ilosc); printf ("%s , %f \n", Ryby[i].gatunek, Ryby[z].ilosc); for (int j=0;j %s , %f , [%d] [%d] -----> %f + %f\n\n", Ryby[i].gatunek, Ryby[z].ilosc, i,z, c, Ryby[j].ilosc); (Ryby[j].ilosc) = 0; printf ("%d",Ryby[j].ilosc); } else { printf ("nie powtorzylem sie --> %s %f \n", Ryby[i].gatunek, Ryby[i].ilosc); } } z++; i++; //linczik } zapisz = fopen ("zpolow.txt","w"); if (NULL==zapisz) { perror ("blad"); fclose (wczytaj); exit (1); } for (int j=0; j