Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- int main(){
- fstream dzieci_plik("DZIECI.txt");
- fstream preferencje_plik("PREFERENCJE.txt");
- fstream przedszkola_plik("PRZEDSZKOLA.txt");
- if(dzieci_plik.good() && preferencje_plik.good() && przedszkola_plik.good()){
- // prweferencje z przedszkolem o id 76
- int typ=0;// Pesel;Numer_preferencji;Id_przedszkola
- string preferencja[3];
- for (string pole; getline(preferencje_plik, pole, ';'); ) {
- preferencja[typ]=pole;
- if(typ==2){
- if(preferencja[2]=="76"){
- cout<<preferencja[2];
- }
- typ=0;
- } else{
- typ++;
- }
- }
- return 0;
- // wszystkie dziewczynki
- typ=0;// Pesel;Nazwisko;Imie;Plec;Wiek
- string dziecko[5];
- for (string pole; getline(dzieci_plik, pole, ';'); ) {
- dziecko[typ]=pole;
- if(typ==4){// uzyskano caly rekord
- if(dziecko[3]=="dziewczynka"){
- cout<<dziecko[2]<<' '<<dziecko[1]<<'\n';
- }
- typ=0;
- }
- typ++;
- }
- } else {
- cout<<"Błąd plików";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement