Advertisement
Guest User

Untitled

a guest
Nov 27th, 2014
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <cmath>
  4. #include <string>
  5.  
  6. using namespace std ;
  7.  
  8. int main () {
  9.     ifstream arq ;
  10.     ofstream arqs ;
  11.     int cont = 0, i ;
  12.     string linha[100];
  13.    
  14.     arq.open ("arq1.txt") ;
  15.    
  16.     for ( i = 0 ; i < 100 ; i++ )
  17.     {
  18.         getline (arq, linha[i]) ;
  19.         if ( linha[i].size() == 0 )
  20.         {
  21.             break ;
  22.         }
  23.         else
  24.         {
  25.             cont ++ ;
  26.         }
  27.     }
  28.    
  29.     arqs.open ("arqs2.txt") ;
  30.    
  31.     for ( i = 0  ; i < cont  ; i  -- )
  32.     {
  33.         arqs << linha[i] << endl ;
  34.     }
  35.    
  36.     arq.close();
  37.     arqs.close() ;
  38.    
  39.     return 0 ;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement