Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- void rysuj(int);
- int bezwzgledna(int);
- using namespace std;
- int bezwzgledna(int a){
- if(a<0){
- a=-a;
- }
- return a;
- }
- void rysuj(int bok){
- for(int y=-(bok-1); y<(bok-1)+1; y++){
- for(int x=-(bok+((bok-1)/2)-1); x<(bok+((bok-1)/2)-1)+1; x++){
- if(bezwzgledna((x+bok+((bok-1)/2))-1)==bezwzgledna(y) or bezwzgledna(x-bok-((bok-1)/2)+1)==bezwzgledna(y))
- {
- cout<<"*";
- }
- else if((bezwzgledna(y)==(bok-1)) and bezwzgledna(x)<=((bok-1)/2))
- {
- cout<<"*";
- }
- else
- {
- cout<<" ";
- }
- }
- cout<<endl;
- }
- }
- int main()
- {
- int bok;
- cout<<"Podaj bok(dls wartosci parzystej przyjeta zostanie o 1 mniejsza): ";
- cin>>bok;
- if(bok%2==0){
- bok==bok-1;
- }
- rysuj(bok);
- return 0;
- }
Add Comment
Please, Sign In to add comment