fork download
  1. // ConsoleApplication4.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6.  
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11. int tab[100][100];
  12. int N = 10;
  13. for (int i = 0; i < 100; i++){
  14. for (int j = 0; j < 100; j++){
  15. tab[i][j] = 0;
  16. }
  17. }
  18. int kier = 0;
  19. int x = 0;
  20. int y = 0;
  21. int ile = N;
  22. bool first = true;
  23.  
  24.  
  25.  
  26. while (1){
  27. if (kier == 0){
  28. for (int i = 0; i < ile; i++)
  29. tab[x][y++] = 1;
  30. y--;
  31. if (!first)
  32. ile -= 2;
  33. first = false;
  34. }
  35. else if (kier == 1){
  36. for (int i = 0; i < ile; i++)
  37. tab[x++][y] = 1;
  38. x--;
  39. }
  40. else if (kier == 2){
  41. for (int i = 0; i < ile; i++)
  42. tab[x][y--] = 1;
  43. y++;
  44. ile -= 2;
  45. if (ile == 2) tab[x - 1][y] = 1;
  46. }
  47. else if (kier == 3){
  48. for (int i = 0; i < ile; i++)
  49. tab[x--][y] = 1;
  50. x++;
  51. }
  52.  
  53. if (ile <= 2)
  54. break;
  55. kier += 1;
  56. kier %= 4;
  57. }
  58.  
  59. for (int a = 0; a <= 8; a++){
  60. cout << endl;
  61.  
  62. if (a == 0 || a == 5) {
  63. for (int i = 0; i < N; i++){
  64. for (int j = 0; j < N; j++){
  65. cout << (tab[j][i] == 1 ? "*" : " ");
  66. }
  67. cout << endl;
  68. }
  69. }
  70.  
  71. else if (a % 4 == 0){
  72. for (int i = 0; i < N; i++){
  73. for (int j = 0; j < N; j++){
  74. cout << (tab[j][i] == 1 ? "*" : " ");
  75. }
  76. cout << endl;
  77. }
  78. }
  79.  
  80. else if (a % 3 == 0) {
  81. for (int i = 0; i < N; i++){
  82. for (int j = 0; j < N; j++){
  83. cout << (tab[i][j] == 1 ? "*" : " ");
  84. }
  85. cout << endl;
  86. }
  87. }
  88.  
  89. else if (a % 2 == 0 && a % 4 != 0) {
  90. for (int i = 0; i < N; i++){
  91. for (int j = 0; j < N; j++){
  92. cout << (tab[i][j] == 1 ? "*" : " ");
  93. }
  94. cout << endl;
  95. }
  96. }
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103. }
  104.  
  105. return 0;
  106. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:4:20: fatal error: stdafx.h: No such file or directory
 #include "stdafx.h"
                    ^
compilation terminated.
stdout
Standard output is empty