Advertisement
Robert_JR

S. Wave Form.cpp

Nov 28th, 2016
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.17 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdio>
  3. #include <algorithm>
  4. #include <cmath>
  5. #include <string>
  6. #include <cstdlib>
  7. #define DEBUGG freopen("f:\\in.txt", "rt", stdin);freopen("f:\\out.txt", "wt", stdout);
  8. #define FOR(n) for(int i = 0; i < n; i++)
  9. #define ll long long int
  10. #define TESTCASE int t;scanf("%d", &t);for(int tc = 0; tc < t; tc++)
  11. #define PF printf
  12. #define SF scanf
  13. #define EP 0.000000001
  14. using namespace std;
  15.  
  16. int main()
  17. {
  18.     int n;
  19.     TESTCASE
  20.     {
  21.         cin >> n;
  22.         int temp = 1;
  23.  
  24.         if(n == 1) cout << '*' << endl;
  25.         else
  26.         {
  27.             for(int i = n; i > 0; i--)
  28.             {
  29.                 for(int j = 1; j < i; j++) cout << ' ';
  30.                 for(int j = 0; j < temp; j++) cout << '*';
  31.                 cout << endl;
  32.                 temp += 2;
  33.             }
  34.             temp -= 4;
  35.             for(int i = 1; i < n; i++)
  36.             {
  37.                 for(int j = 0; j < i; j++) cout << ' ';
  38.                 for(int j = 0; j < temp; j++) cout << '*';
  39.                 cout << endl;
  40.                 temp -= 2;
  41.             }
  42.         }
  43.         if(tc != t-1)
  44.             cout << endl;
  45.     }
  46.  
  47.  
  48.     return 0;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement