Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main()
- {
- int k,w, kolumny, wiersze;
- cout << "ilosc kolumn" << endl;
- cin >> kolumny;
- cout << "ilosc wierszy" << endl;
- cin >> wiersze;
- for (w=0;w<wiersze;w++)
- {
- if (w % 2 == 0)
- {
- for (k=0;k<kolumny;k++)
- cout <<"x";
- }
- else
- {
- for (k=0;k<kolumny;k++)
- cout <<".";
- }
- cout <<endl;
- }
- //DRUGIE ZADANIE
- for (w=0;w<wiersze;w++)
- {
- for (k=0;k<kolumny;k++)
- {
- if (k % 2 == 0)
- cout <<"x";
- else cout <<".";
- }
- cout <<endl;
- }
- //TRZECIE
- for (w=wiersze;w>0;w--)
- {
- for (k=kolumny;k>w;k--)
- cout <<".";
- for (k=w;k>0;k--)
- cout <<"x";
- cout <<endl;
- }
- // CZWARTE
- for (w=0; w<=(wiersze/2);w++)
- {
- for (k=0;k<w;k++)
- cout << ".";
- for (k=(kolumny-w);k>w;k--)
- cout << "x";
- for (k=0;k<w;k++)
- cout << ".";
- cout << endl;
- }
- --k;
- int temp = 1;
- for (w=0; w<(wiersze/2)-1;w++) {
- ++temp;
- for (int j=k-w;j>0;j--)
- cout << ".";
- for (int j=0;j<=w+temp;j++)
- cout << "x";
- for (int j=k-w;j>0;j--)
- cout << ".";
- cout << endl;
- }
- //PIĄTE
- for(w=0;w<wiersze;w++)
- {
- for(k=0;k<kolumny;k++ )
- {
- if((w+k)%2==0)
- cout <<"x";
- else cout <<".";
- }
- cout << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement