Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- int main()
- {
- const int maxSize{ 9 };
- const char pos{ '*' };
- const char neg{ ' ' };
- bool positive{ false };
- for (int y{ 0 }; y < maxSize; ++y)
- {
- for (int x{ 0 }; x < maxSize; ++x)
- {
- //positive = ((x + y == maxSize - 1) or (x == y));
- positive = ((x + y <= maxSize -1)) and (x >= y);
- std::cout << ' ' << (positive ? pos : neg) << ' ';
- }
- std::cout << '\n';
- }
- std::cout << '\n';
- }
- // a > b -> mA < mB
- // -2 -1 0 1 2
- // a = 2 b = 1
- // a > b = true
- // a = -2 b = -1
- // mA < mB = true
- //a maxSize = 4
- // 0 1 2 3
- // 0 * * * *
- // 1 * * *
- // 2 * *
- // 3 *
- //B maxSize = 4
- // 0 1 2 3
- // 0 # # # *
- // 1 # # * #
- // 2 # * # #
- // 3 * # # #
Add Comment
Please, Sign In to add comment