Advertisement
avr39ripe

BR012frameExample

Feb 10th, 2021
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.78 KB | None | 0 0
  1. #include <iostream>
  2. #include <chrono>
  3. #include <thread>
  4.  
  5.  
  6. /*
  7. *******
  8. *#####*
  9. *#***#*
  10. *#***#*
  11. *#***#*
  12. *#####*
  13. *******
  14. */
  15.  
  16. int main()
  17. {
  18.     int side{15};
  19.     int sub{ 6 };
  20.     //std::cout << "enter line length\n";
  21.     //std::cin >> side;
  22.     const char pos = '#';
  23.     const char neg = ' ';
  24.     bool positive{ false };
  25.     bool hPositive{ false };
  26.     bool vPositive{ false };
  27.  
  28.     for (int y{ 0 }; y < side; ++y)
  29.     {
  30.         for (int x{ 0 }; x < side; ++x)
  31.         {
  32.             hPositive = ((y == sub or y == (side - 1 - sub)) and (x >= sub and x <= (side - 1 - sub)));
  33.             vPositive = ((x == sub or x == (side - 1 - sub)) and (y >= sub and y <= (side - 1 - sub)));
  34.             positive = (hPositive or vPositive);
  35.            
  36.             std::cout << ' ' << (positive ? pos : neg) << ' ';
  37.         }
  38.         std::cout << '\n';
  39.     }
  40.        
  41.     return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement