// ConsoleApplication4.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
int tab[100][100];
int N = 10;
for (int i = 0; i < 100; i++){
for (int j = 0; j < 100; j++){
tab[i][j] = 0;
}
}
int kier = 0;
int x = 0;
int y = 0;
int ile = N;
bool first = true;
while (1){
if (kier == 0){
for (int i = 0; i < ile; i++)
tab[x][y++] = 1;
y--;
if (!first)
ile -= 2;
first = false;
}
else if (kier == 1){
for (int i = 0; i < ile; i++)
tab[x++][y] = 1;
x--;
}
else if (kier == 2){
for (int i = 0; i < ile; i++)
tab[x][y--] = 1;
y++;
ile -= 2;
if (ile == 2) tab[x - 1][y] = 1;
}
else if (kier == 3){
for (int i = 0; i < ile; i++)
tab[x--][y] = 1;
x++;
}
if (ile <= 2)
break;
kier += 1;
kier %= 4;
}
for (int a = 0; a <= 8; a++){
cout << endl;
if (a == 0 || a == 5) {
for (int i = 0; i < N; i++){
for (int j = 0; j < N; j++){
cout << (tab[j][i] == 1 ? "*" : " ");
}
cout << endl;
}
}
else if (a % 4 == 0){
for (int i = 0; i < N; i++){
for (int j = 0; j < N; j++){
cout << (tab[j][i] == 1 ? "*" : " ");
}
cout << endl;
}
}
else if (a % 3 == 0) {
for (int i = 0; i < N; i++){
for (int j = 0; j < N; j++){
cout << (tab[i][j] == 1 ? "*" : " ");
}
cout << endl;
}
}
else if (a % 2 == 0 && a % 4 != 0) {
for (int i = 0; i < N; i++){
for (int j = 0; j < N; j++){
cout << (tab[i][j] == 1 ? "*" : " ");
}
cout << endl;
}
}
}
return 0;
}