// operacje na plikach, struktura // Miasta.cpp : Defines the entry point for the console application. // #define _CRT_SECURE_NO_DEPRECATE #include "stdafx.h" #include #include #include #include #include struct struct_Miasto { char nazwa[100]; float opady; int numer; }; int _tmain(int argc, _TCHAR* argv[]) { char porownanie; int i=0; struct_Miasto Miasto [100]; FILE *wczytaj; FILE *zapisz; wczytaj = fopen ("wopady.txt","r"); if (NULL==wczytaj) { perror ("blad"); exit (1); } while (!feof (wczytaj)) { fscanf (wczytaj," %s %f", &Miasto[i].nazwa, &Miasto[i].opady); printf ("%s %.2f \n",Miasto[i].nazwa, Miasto[i].opady); for (int j=0;j= (Miasto[j].opady)) { Miasto[j].opady = Miasto[i].opady; } i--; } } // for i++; } zapisz = fopen ("zopady.txt","w"); if (zapisz == NULL ) { perror ("blad"); fclose (wczytaj); exit (1); } for (int j=0; j