blob: 3f32ebf0a3baa46c07f360826ea3648df8be015e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#include <iostream>
using namespace std;
const short LOWERLIMIT = 2;
const short UPPERLIMIT = 9;
const char SEPARATOR = ' ';
int main()
{
short N;
char S;
cin >> N >> S;
if (N < LOWERLIMIT || N > UPPERLIMIT)
return -1; //end program
for (int i = 1; i <= N; i++)
{
for (int j = N - i; j > 0; j--)
cout << SEPARATOR;
for (int k = 1; k < 2 * i; k++)
cout << S;
cout << endl;
}
for (int i = 1; i < N; i++)
{
for (int j = 1; j <= i; j++)
cout << SEPARATOR;
for (int k = 1; k < 2 * (N - i); k++)
cout << S;
cout << endl;
}
return 0;
}
|