Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int linesize;
- int n;
- void rep(char c, int t)
- {
- for (int i = 0; i < t; ++i)
- printf("%c", c);
- }
- void printline(int i)
- {
- int mid = 4*i-3; // size of middle portion c-b-a-b-c
- int lr = (linesize-mid)/2;
- rep('-', lr);
- for (int j = i-1; j >= 1; --j)
- printf("%c-", ('a'+n-i)+j);
- printf("%c", 'a'+n-i);
- for (int j = 1; j <= i-1; ++j)
- printf("-%c", ('a'+n-i)+j);
- rep('-', lr);
- printf("\n");
- }
- int main()
- {
- scanf("%d", &n);
- linesize = 4*n-3;
- for (int i = 1; i <= n; ++i)
- printline(i);
- for (int i = n-1; i >= 1; --i)
- printline(i);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement