/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <iostream>
#include <cmath>
using namespace std;
void galezie (int h);
void pien (int h);
int
main ()
{
int h = 21;
galezie(h); //y=|x-h|+r
pien (h);
return 0;
}
//////////////////////////////////////////////
void
galezie (int h)
{
int r = 0;
for (int y = 0; y < h; y++)
{
for (int x = 0; x < 2 * h; x++)
{
if (y > abs (x - h) + 3 * r) // 3 -> głebokość wcięcia
cout << "*";
else
cout << " ";
}
cout << endl;
r = y / 7; // ilość warst bez skoku
}
}
void
pien (int h)
{
for (int y = 0; y < 0.2 * h + 1; y++)
{
for (int x = 0; x < 2 * h; x++)
{
if (x > h - 2 && x < h + 2)
cout << "*";
else
cout << " ";
}
cout << endl;
}
return;
}