Advertisement
XuanHong

LTTS - in hình tam giác đối xứng ngược

Jan 31st, 2015
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. // LTTS - in hình tam giác đối xứng ngược
  2.  
  3. #include <iostream>
  4. #include <string >
  5. using namespace std;
  6.  
  7. void in(int n, char x)
  8. {
  9.     for (int i = 0; i < n; i++)
  10.         cout << x;
  11. }
  12.  
  13. void main()
  14. {
  15.     int n;
  16.     cin >> n;
  17.     for (int i = n; i>=1; i--)
  18.     {
  19.         in(n - 1, ' ');
  20.         in(i, '*');
  21.         cout << endl;
  22.     }
  23.     for (int i = n-1; i >=0; i--)
  24.     {
  25.         in(i, ' ');
  26.         in(n-i, '*');
  27.         cout << endl;
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement