Advertisement
Guest User

kodzik

a guest
Oct 18th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.00 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int W;
  6. int K;
  7.  
  8. int main()
  9. {  
  10.     cout << "Podaj liczbe wierszy: "; cin >> W;
  11.     cout << "Podaj liczbe kolumn: "; cin >> K;
  12.     cout << endl;
  13.  
  14.     cout << "1." << endl;
  15.     for (int i = 0; i < W; ++i) {
  16.         for (int j = 0; j < K; ++j) {
  17.             if (i == 0 || i % 2 == 0) {
  18.                 cout << "x";
  19.             }
  20.             else {
  21.                 cout << ".";
  22.             }
  23.         } cout << endl;
  24.     }
  25.  
  26.     cout << endl;
  27.     cout << "2." << endl;
  28.     for (int i = 0; i < W; ++i) {
  29.         for (int j = 0; j < K; ++j) {
  30.             cout << "x.";
  31.         }   cout << endl;
  32.     }
  33.  
  34.     cout << endl;;
  35.     cout << "3." << endl;
  36.     for (int i = 0; i < W; ++i) {
  37.         for (int j = 0; j < K; ++j) {
  38.             if (i <= j) {
  39.                 cout << "x";
  40.             }
  41.             else {
  42.                 cout << ".";
  43.             }
  44.         }cout << endl;
  45.     }
  46.  
  47.  
  48.  
  49.     cout << endl;
  50.     cout << "4." << endl;
  51.  
  52.  
  53.  
  54.     cout << endl;
  55.     cout << "5." << endl;
  56.     for (int i = 0; i < W; ++i) {
  57.         for (int j = 0; j < K; ++j) {
  58.             if (i == 0 || i % 2 == 0) {
  59.                 cout << "x.";
  60.             }
  61.             else {
  62.                 cout << ".x";
  63.             }
  64.         } cout << endl;
  65.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement