fork download
  1. #include <fstream>
  2. #include <cstdlib>
  3.  
  4. int main(int i,const char**v)
  5. {
  6. for(int n=0; n<atoi(v[2]); ++n)
  7. {
  8. std::ifstream ifs(v[1]);
  9. *v="out.txt";
  10. char b[40][83], O[]="...X.....";
  11. for(i=0; i<40; ++i)
  12. {
  13. ifs>>b[i];
  14. }
  15. std::ofstream ofs(*v);
  16. ofs<<b[0]<<'\n';
  17. for(i=1; i<39; ++i)
  18. {
  19. ofs<<'.';
  20. for(int j=1; j<79; ++j)
  21. {
  22. O[2] = b[i][j];
  23. ofs << O[
  24. (b[i+-1][j+0] == 'X')
  25. +(b[i+1][j+0] == 'X')
  26. +(b[i+0][j+-1] == 'X')
  27. +(b[i+0][j+1] == 'X')
  28. +(b[i+-1][j+-1] == 'X')
  29. +(b[i+1][j+1] == 'X')
  30. +(b[i+1][j+-1] == 'X')
  31. +(b[i+-1][j+1] == 'X')];
  32. }
  33. ofs<<".\n";
  34. }
  35. ofs<<b[0]<<'\n';
  36. }
  37. }
  38.  
Success #stdin #stdout 0.01s 2724KB
stdin
Standard input is empty
stdout
Standard output is empty