Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main()
- {
- int n = 0;
- cout << "Podaj liczbe gwiazdek: ";
- cin >> n;
- //Ile linii?
- int lines = 0;
- int chars = 0;
- int lchars = 0;
- while(chars<n)
- {
- lines++;
- chars = chars+lines;
- }
- lchars = lines - (chars - n);
- cout << "\n Lines: " << lines;
- cout << "\n Chars: " << chars;
- cout << "\n Last line" << lchars;
- /*
- for(int i=0; i<lines; i++)
- {
- while(chars<n && cline)
- cout << "\naaaa";
- }
- */
- cout << "\n";
- for(int i=0; i<lines-1; i++)
- {
- for(int j=0; j<=i; j++)
- {
- cout << "*";
- }
- cout << "\n";
- }
- for(int j=0; j<lchars; j++)
- {
- cout << "*";
- }
- cout << "\n";
- cout << "\n";
- for(int i=lines; i>0; i--)
- {
- for(int j=i; j>0; j--)
- {
- cout << "*";
- }
- cout << "\n";
- }
- cout << "\n";
- for(int i=0; i<lines; i++)
- {
- for(int k=0; k<i; k++)
- {
- cout << " ";
- }
- for(int j=(lines-i); j>0; j--)
- {
- cout << "*";
- }
- cout << "\n";
- }
- cout << "\n";
- for(int i=0; i<n; i++)
- {
- for(int k=(n-i); k>1; k--)
- {
- cout << " ";
- }
- for(int j=0; j<=i; j++)
- {
- cout << "*";
- }
- cout << "\n";
- }
- cout << "\n";
- for(int i=0; i<n; i++)
- {
- for(int j=0; j<((n-i)/2); j+=2)
- {
- cout << " ";
- }
- for(int j=0; j<i; j+=2)
- {
- cout << "*";
- }
- /*
- for(int j=0; j<(n-i)/2; j++)
- {
- cout << " ";
- }
- */
- cout << "|\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement