SHARE
TWEET

Untitled

a guest Mar 19th, 2019 41 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. int main() {
  4.  
  5.     int row, col;
  6.     int size;
  7.     int diagA, diagB;
  8.  
  9.     std::cout << "Enter height of the песочные часы ";
  10.     std::cin >> size;
  11.  
  12.     for (row = 0; row < size; row++) {
  13.         for (col = 0; col < size; col++) {
  14.  
  15.             diagA = row;
  16.             diagB = size - row - 1;
  17.  
  18.             if (diagA <= diagB) {
  19.                 if (col >= diagA && col <= diagB)
  20.                     std::cout << "1 ";
  21.                 else
  22.                     std::cout << "0 ";
  23.             } else {
  24.                 if (col >= diagB && col <= diagA)
  25.                     std::cout << "1 ";
  26.                 else
  27.                     std::cout << "0 ";
  28.             }
  29.         }
  30.         std::cout << std::endl;
  31.     }
  32.  
  33.     std::cout << std::endl;
  34.  
  35.     return 0;
  36. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top