fork download
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4.  
  5. const size_t Ysize=5;
  6. const size_t Xsize=7;
  7. int map[Ysize][Xsize];
  8.  
  9. bool loadMap()
  10. {
  11. //ifstream file(testmap.txt);
  12. istream &file=cin;
  13. if(!file) return false;
  14. for(size_t y=0;y<Ysize;++y) for(size_t x=0;x<Xsize;++x) file>>map[y][x];
  15. return true;
  16. }
  17.  
  18. int main()
  19. {
  20. if(!loadMap())
  21. {
  22. cerr<<"Cannot open the file"<<endl;
  23. return 1;
  24. }
  25. for(size_t y=0;y<Ysize;++y,cout<<endl) for(size_t x=0;x<Xsize;++x) cout<<"X."[map[y][x]];
  26. return 0;
  27. }
Success #stdin #stdout 0s 2900KB
stdin
1 1 1 1 1 1 1
1 1 1 0 1 1 1
1 1 1 0 1 1 1
1 1 1 0 1 1 1
1 1 1 1 1 1 1
stdout
.......
...X...
...X...
...X...
.......