Facebook
From pytson, 6 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 220
  1. /*
  2. #include <iostream>
  3. #include <fstream>
  4. #include <string>
  5.  
  6. using namespace std;
  7.  
  8. int main() {
  9.  
  10.         ifstream plik;
  11.         plik.open("pliki.txt");
  12.         plik.eof();
  13.         string wyraz;
  14.         int i = 0;
  15.         while (plik.eof() == false)
  16.         {
  17.                 plik >> wyraz;
  18.                 cout << wyraz << " ";
  19.                 i++;
  20.                 if (i == 4)
  21.                 {
  22.                         cout << endl;
  23.                         i = 0;
  24.                 }
  25.         }
  26.         plik.close();
  27.  
  28.  
  29.         system("pause");
  30.         return 0;
  31.  
  32. }
  33.  
  34. */
  35.  
  36. #include<iostream>
  37. #include<fstream>
  38. #include<string>
  39.  
  40. using namespace std;
  41.  
  42. int main() {
  43.         int a;
  44.         cout << "wpisz ile znakow chcesz nadpisac ";
  45.         cin >> a;
  46.         ofstream plik;
  47.         plik.open("znaczki.txt");
  48.         char b;
  49.         cout << "wprowadz znaki: ";
  50.         for (int i = 0; i < a; i++)
  51.         {
  52.                 cin >> b;
  53.                 plik << b;
  54.        
  55.         }
  56.         plik.close();
  57.        
  58.  
  59.  
  60.         system("pause");
  61. }
  62.