Advertisement
LucianFi

laborator 1

Oct 10th, 2023
965
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.43 KB | Source Code | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4.     //1
  5.     cout << "     *     " << endl;
  6.     cout << "    ***   " << endl;
  7.     cout << "   *****  " << endl;
  8.     cout << "  *******  " << endl;
  9.     cout << "     *     " << endl;
  10.     cout << "     *     " << endl;
  11.  
  12.     cout << " " << endl;
  13.  
  14.     //2
  15.     cout << string(1, ' ') << endl;
  16.     cout << string(4, ' ') << string(1, '*') << endl;
  17.     cout << string(3, ' ') << string(3, '*') << endl;
  18.     cout << string(2, ' ') << string(5, '*') << endl;
  19.     cout << string(1, ' ') << string(7, '*') << endl;
  20.     cout << string(4, ' ') << string(1, '*') << endl;
  21.     cout << string(4, ' ') << string(1, '*') << endl;
  22.  
  23.     cout << " " << endl;
  24.  
  25.     //3
  26.     int i;
  27.     int n;
  28.     n = 4;
  29.  
  30.     i = 1; cout << string(3, ' '); cout << string((i - 1) * 2 + 1, '*') << endl;
  31.     i = 2; cout << string(2, ' '); cout << string((i - 1) * 2 + 1, '*') << endl;
  32.     i = 3; cout << string(1, ' '); cout << string((i - 1) * 2 + 1, '*') << endl;
  33.     i = 4; cout << string(0, ' '); cout << string((i - 1) * 2 + 1, '*') << endl;
  34.     i = 1; cout << string(n-1, ' '); cout << string((i - 1) * 2 + 1, '*') << endl;
  35.     i = 1; cout << string(n-1, ' '); cout << string((i - 1) * 2 + 1, '*') << endl;
  36.  
  37.     cout << " " << endl;
  38.  
  39.     //4
  40.  
  41.     n = 4;
  42.     for (i = 1; i <= n; i++)
  43.  
  44.     {
  45.         cout << string(n - i, ' '); cout << string((i - 1) * 2 + 1, '*') << endl;
  46.  
  47.     }
  48.     cout << string(n - 1, ' '); cout << string(1, '*') << endl;
  49.     cout << string(n - 1, ' '); cout << string(1, '*') << endl;
  50.  
  51. }
Tags: ISM
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement