Advertisement
MeehoweCK

Untitled

Jan 7th, 2021
670
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     ofstream Plik;
  9.     string nazwa_pliku;
  10.     cout << "Podaj nazwe pliku, do ktorego chcesz wpisac tekst: ";
  11.     cin >> nazwa_pliku;
  12.     Plik.open(nazwa_pliku.c_str());
  13.     cout << "Podaj tekst, ktory chcesz wpisac do pliku: ";
  14.     string tekst;
  15.     cin.ignore(99999, '\n');        // wyczyszczenie buforu wejścia
  16.     getline(cin, tekst);
  17.     Plik << tekst;
  18.     Plik.close();
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement