Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <string>
- using namespace std;
- void main(void)
- {
- // deklaracija objekta in_files klase ulaznog toka
- // uz otvaranje datoteke cities
- ifstream in_file("cities");
- ofstream out_file("filter");
- // provjera uspješnosti otvaranja datoteke
- if (!in_file)
- return;
- string string_A;
- // petlja za èitanje se prekida kod nailaska na kraj datoteke
- while (!in_file.eof())
- {
- // èitanje jednog stringa iz datoteke
- in_file >> string_A;
- // ispisivanje stringa na ekran
- cout << string_A << " ";
- if (string_A != "zzz")
- out_file << string_A << " ";
- }
- getchar();
- // zatvaranje datoteke
- in_file.close();
- out_file.close();
- //otvaranje filtera
- ifstream in_file1("filter");
- if (!in_file1)
- return;
- string string_B;
- while (!in_file1.eof())
- {
- in_file1 >> string_B;
- cout << string_B << " ";
- }
- getchar();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement