fork download
  1. #include<iostream>
  2.  
  3. bool ShowLine(std::size_t N,char F,char E){
  4. for (std::size_t i = 0; i < N; i++){
  5. std::cout << F;
  6. }
  7. for (std::size_t i = 0; i < N; i++){
  8. std::cout << E;
  9. }
  10. std::cout << std::endl;
  11.  
  12. return true;
  13. }
  14. bool ShowTanbo(std::size_t N){
  15. char F = '0';
  16. char E = '1';
  17. for (std::size_t i = 0; i < N; i++){
  18. ShowLine(N, F, E);
  19. }
  20. std::swap(F, E);
  21. for (std::size_t i = 0; i < N; i++){
  22. ShowLine(N, F, E);
  23. }
  24. return true;
  25. }
  26. int main(){
  27.  
  28. for (std::size_t i = 1; i <= 5; i++){
  29. ShowTanbo(i);
  30. std::cout << std::endl;
  31. }
  32.  
  33. return 0;
  34. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
01
10

0011
0011
1100
1100

000111
000111
000111
111000
111000
111000

00001111
00001111
00001111
00001111
11110000
11110000
11110000
11110000

0000011111
0000011111
0000011111
0000011111
0000011111
1111100000
1111100000
1111100000
1111100000
1111100000