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