Advertisement
awsmpshk

Untitled

Mar 1st, 2020
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. void f(int n, int a) {
  6. for (int i = 0; i < a; ++i) {
  7. cout << "*";
  8. }
  9. for (int i = 0; i < n - 2 * (a - 1); ++i) {
  10. cout << ".";
  11. }
  12. for (int i = 0; i < a; ++i) {
  13. cout << "*";
  14. }
  15. cout << endl;
  16. if (a - 1 == n / 2) {
  17. return;
  18. }
  19. f(n, ++a);
  20. for (int i = 0; i < a - 1; ++i) {
  21. cout << "*";
  22. }
  23. for (int i = 0; i < n - 2 * (a - 2); ++i) {
  24. cout << ".";
  25. }
  26. for (int i = 0; i < a - 1; ++i) {
  27. cout << "*";
  28. }
  29. cout << endl;
  30. }
  31.  
  32. int main() {
  33. int n, a = 1;
  34. cin >> n;
  35. f(n, a);
  36. cout << endl;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement