Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using std::cout;
- using std::cin;
- using std::endl;
- void main()
- {
- int size, k = 0;
- cin >> size; cout << endl;
- for (int i = 0; i < size; i++)
- {
- for (int j = 0; j <= k; j++)
- {
- if (k >= j) cout << "*";
- }
- if (i < (size / 2)) k++; else k--;
- cout << endl;
- }
- }
- for (int i = 0; i < size; i++)
- {
- k = (size-1)/2 - abs((size-1-2*i)/2);
- for (int j = 0; j <= k; j++)
- {
- if (k >= j) cout << "*";
- }
- cout << endl;
- }
- int size = 6;
- for (int i = 1; i <= size; i++)
- {
- int nstars = std::min(i, size + 1 - i);
- std::cout << std::string(nstars, '*') << std::endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement