fork download
  1. #include <iostream>
  2.  
  3. int main()
  4. {
  5. int size = 8;
  6.  
  7. for (int i = 0; i < size; ++i)
  8. {
  9. for (int j = 0; j < size; ++j)
  10. {
  11. if (i == j || i == size - j - 1)
  12. {
  13. std::cout << "1 ";
  14. }
  15. else
  16. {
  17. std::cout << "0 ";
  18. }
  19. }
  20.  
  21. std::cout << std::endl;
  22. }
  23.  
  24. return 0;
  25. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
1 0 0 0 0 0 0 1 
0 1 0 0 0 0 1 0 
0 0 1 0 0 1 0 0 
0 0 0 1 1 0 0 0 
0 0 0 1 1 0 0 0 
0 0 1 0 0 1 0 0 
0 1 0 0 0 0 1 0 
1 0 0 0 0 0 0 1