Advertisement
Guest User

Untitled

a guest
Jun 24th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. #include <cstdlib>
  2. #include <fstream>
  3.  
  4. void Kappa(int n, char inName[], char outName[]){
  5.  
  6.     std::fstream in;
  7.     in.open(inName, std::fstream::in);
  8.     std::fstream out;
  9.     out.open(outName, std::fstream::out);
  10.  
  11.     in.seekg(0, in.end);
  12.     int len = in.tellg();
  13.     char c;
  14.  
  15.     while (n-- && len--)
  16.     {
  17.         in.seekg(len, in.beg);
  18.         c = in.get();
  19.  
  20.         if(std::isdigit(c)){
  21.             c = '0' + ('9' - c);
  22.         }
  23.  
  24.         out << c;
  25.     }
  26.  
  27.     in.close();
  28.     out.close();
  29.  
  30. }
  31.  
  32. int main(int argc, char* argv[]){
  33.  
  34.     int x;
  35.  
  36.     x = strtol(argv[1], NULL, 10);
  37.  
  38.     Kappa(x, argv[2], argv[3]);
  39.  
  40. return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement