avr39ripe

cppTriangleBase

Jun 28th, 2021
807
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <chrono>
  3. #include <thread>
  4.  
  5. //0 1   2   3   4
  6.  
  7.  
  8.  //* # # # #
  9.  //# * # # #
  10.  //# # * # #
  11.  //# # # * #
  12.  //# # # # *
  13.  
  14. bool positive{ true };
  15. const char posSymb{ '#' };
  16. const char negSymb{ ' ' };
  17.  
  18. a > b;
  19.  
  20.  
  21. int main()
  22. {
  23.     const int size{ 5 };
  24.    
  25.     for (int y{ 0 }; y < size; ++y)
  26.     {
  27.         for (int x{ 0 }; x < size; ++x)
  28.         {
  29.             //positive = (y == x) or (y + x == size - 1);
  30.             //positive = (y >= x);
  31.             positive = (y >= x) and (y + x >= size - 1);
  32.  
  33.             std::cout << ' ' << (positive ? posSymb : negSymb) << ' ';
  34.             //std::this_thread::sleep_for(std::chrono::milliseconds(500));
  35.         }
  36.         std::cout << '\n';
  37.     }
  38.  
  39.     return 0;
  40. }
RAW Paste Data