bogdanNiculeasa

Templatre for reding/writing to/from files

Nov 25th, 2023
1,079
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream> // file stream
  3. using namespace std;
  4.  
  5.  
  6. int main()
  7. {
  8.     int numar;
  9.     ifstream fin("bac.in"); // input file stream
  10.     //ifstream fin("C://Users/bogda/Desktop/bac.txt"); // input file stream
  11.     ofstream fout("bac.out");
  12.     while (fin >> numar) {
  13.         fout << numar << " ";
  14.     }
  15.    
  16.  
  17.     fin.close();
  18.     fout.close();
  19.     return 0;
  20. }
  21.  
Advertisement
Add Comment
Please, Sign In to add comment