Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- //1
- cout << " * " << endl;
- cout << " *** " << endl;
- cout << " ***** " << endl;
- cout << " ******* " << endl;
- cout << " * " << endl;
- cout << " * " << endl;
- cout << " " << endl;
- //2
- cout << string(1, ' ') << endl;
- cout << string(4, ' ') << string(1, '*') << endl;
- cout << string(3, ' ') << string(3, '*') << endl;
- cout << string(2, ' ') << string(5, '*') << endl;
- cout << string(1, ' ') << string(7, '*') << endl;
- cout << string(4, ' ') << string(1, '*') << endl;
- cout << string(4, ' ') << string(1, '*') << endl;
- cout << " " << endl;
- //3
- int i;
- int n;
- n = 4;
- i = 1; cout << string(3, ' '); cout << string((i - 1) * 2 + 1, '*') << endl;
- i = 2; cout << string(2, ' '); cout << string((i - 1) * 2 + 1, '*') << endl;
- i = 3; cout << string(1, ' '); cout << string((i - 1) * 2 + 1, '*') << endl;
- i = 4; cout << string(0, ' '); cout << string((i - 1) * 2 + 1, '*') << endl;
- i = 1; cout << string(n-1, ' '); cout << string((i - 1) * 2 + 1, '*') << endl;
- i = 1; cout << string(n-1, ' '); cout << string((i - 1) * 2 + 1, '*') << endl;
- cout << " " << endl;
- //4
- n = 4;
- for (i = 1; i <= n; i++)
- {
- cout << string(n - i, ' '); cout << string((i - 1) * 2 + 1, '*') << endl;
- }
- cout << string(n - 1, ' '); cout << string(1, '*') << endl;
- cout << string(n - 1, ' '); cout << string(1, '*') << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement