Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void spiral()
- {
- string tab[10][10];
- int szerokosc = 8;
- int wysokosc = 9;
- for (int i = 0; i < 10; i++)
- {
- for (int j = 0; j < 10; j++)
- {
- tab[i][j]=" ";
- }
- }
- int x = 0;
- int y = 8;
- for (int i = 0; i < szerokosc; i++)
- {
- tab[x][i] = "*";
- }
- for (int i = 0; i < wysokosc; i++)
- {
- tab[i][y] = "*";
- }
- for (int i = 2; i < szerokosc; i++)
- {
- tab[x+8][i] = "*";
- }
- for (int i = 1; i < wysokosc - 2; i++)
- {
- tab[i][y+4] = "*";
- }
- int tpa = 0;
- int tpb = 0;
- for (int i = 0; i < 2; i++)
- {
- for (int i = tpa + 3; i < szerokosc - 1; i++)
- {
- tab[x + 2][i] = "*";
- }
- for (int i = tpb + 2; i < wysokosc - 3; i++)
- {
- tab[i][y + 8] = "*";
- }
- szerokosc--;
- wysokosc--;
- x = x + 4;
- y = y - 2;
- tpa++;
- tpb++;
- }
- //Wypisywanie//
- for (int i = 0; i < 10; i++)
- {
- for (int j = 0; j < 10; j++)
- {
- cout << tab[i][j];
- }
- cout << endl;
- }
- }
- int main()
- {
- spiral();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement