Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <chrono>
- #include <thread>
- /*
- *******
- *#####*
- *#***#*
- *#***#*
- *#***#*
- *#####*
- *******
- */
- int main()
- {
- int side{15};
- int sub{ 6 };
- //std::cout << "enter line length\n";
- //std::cin >> side;
- const char pos = '#';
- const char neg = ' ';
- bool positive{ false };
- bool hPositive{ false };
- bool vPositive{ false };
- for (int y{ 0 }; y < side; ++y)
- {
- for (int x{ 0 }; x < side; ++x)
- {
- hPositive = ((y == sub or y == (side - 1 - sub)) and (x >= sub and x <= (side - 1 - sub)));
- vPositive = ((x == sub or x == (side - 1 - sub)) and (y >= sub and y <= (side - 1 - sub)));
- positive = (hPositive or vPositive);
- std::cout << ' ' << (positive ? pos : neg) << ' ';
- }
- std::cout << '\n';
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement