Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- #define SIZE 15
- int main()
- {
- int a = SIZE, j, i, m = 0, k = 0;
- char tab[SIZE][SIZE];
- for (a; a > SIZE / 2; a -= 2)
- {
- for (i = m; i < a; i++)
- {
- for (j = k; j < a; j++)
- {
- tab[i][j] = (i + a == SIZE || j + a == SIZE || j == a - 1 || i == a - 1) ? '*' : ' ';
- if ((i < SIZE / 2 && j < SIZE / 2) && (i - 1 == j&& i%2==1))
- {
- tab[i][j] = ' ';
- }
- else if ((i < SIZE / 2 && j < SIZE / 2) && i-1==j && i%2==0)
- {
- tab[i][j] = '*';
- }
- }
- }
- m += 2;
- k += 2;
- }
- for (i = 0; i < SIZE; i++)
- {
- for (j = 0; j < SIZE; j++)
- {
- cout << tab[i][j] << ' ';
- }
- cout << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement