Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- int main()
- {
- /* fstream f;
- f.open("plik.txt",ios_base::in);
- string s;
- int i;
- f.open("plik.txt", ios_base::app);
- f << "ola" << " " << 17 << endl;
- f << "jola" << " " << 17 << endl;
- f << "tola" << " " << 17 << endl;
- f << "olaf" << " " << 17 << endl;
- f << "pola" << " " << 17 << endl;
- f << "julia" << " " << 17 << endl;
- f.close();
- f.open("plik.txt", ios_base::out);
- for(int i=1; i<=10; i++)
- {
- f<<i<<" ";
- for(int j=1; j<=10; j++)
- {
- f<<i*j<<" ";
- }
- f<<endl;
- }
- f.close();
- for(int i=1; i<=10; i++)
- {
- f>>s;
- cout<<s;
- for(int j=1; j<=10; j++)
- {
- f>>s;
- cout<<s;
- f>>i;
- cout<<i;
- }
- cout<<endl;
- }
- char c[20];
- fstream fo;
- fo.open("plik.txt", ios_base::out);
- fo<<"ala"<<endl;
- fo<<"ola"<<endl;
- fo<<"tola"<<endl;
- fo.close();
- fo.open("plik.txt", ios_base::app | ios::out);
- fo<<"ala"<<endl;
- fo<<"ola"<<endl;
- fo<<"brunhilda"<<endl;*/
- fstream p;
- p.open("plik.txt", ios_base::in);
- char imie[24], nazwisko[24], miejscowosc[24];
- while(!p.eof())
- {
- p.get(imie, ',');
- cout<<imie<<" ";
- p>>nazwisko;
- cout<<nazwisko<<" ";
- p.getline(miejscowosc, 1024);
- cout<<miejscowosc<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement