Facebook
From Tacky Camel, 5 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 193
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4.  
  5. int main(){
  6.        
  7.         unsigned int n;
  8.         ifstream wej ("dane.txt");
  9.         ofstream wyj ("wynik.txt");
  10.        
  11.         while (!wej.eof()){
  12.                 wej >> n;
  13.                 if (n<10) wyj<<n;
  14.                 if (n>9 && n<100) wyj << n/10 << "-" << n%10;
  15.                 if (n>9 && n<1000) wyj << n/100 << "-" << (n%100)/10 << "-" << (n%100)%10;
  16.                 wyj << endl;
  17.         }
  18.         wej.close();
  19.         wyj.close();
  20.        
  21.         return 0;
  22. }