Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- int main()
- {
- bool doorA{};
- bool doorB{};
- // A
- // X
- // - [] - [] -
- // ^
- // B
- // X
- // - [] -
- // - [] -
- std::cout << "Enter doorA state [1/0 - open/close]\n";
- std::cin >> doorA;
- std::cout << "Enter doorB state [1/0 - open/close]\n";
- std::cin >> doorB;
- std::cout << std::boolalpha << "You reach dest point: " << (doorA and doorB) << '\n';
- // all operations return true/false result so it is bool
- // == equal
- // != not equal
- // > greater than
- // < less than
- // >= greater or equal
- // <= less or equal
- //
- // ! - logical "NOT"
- // or , || - logilal "OR"
- // and , && - logical "AND"
- // a b a or b
- // 0 0 0
- // 1 0 1
- // 0 1 1
- // 1 1 1
- // a b a and b
- // 0 0 0
- // 1 0 0
- // 0 1 0
- // 1 1 1
- // a !a
- // 1 0
- // 0 1
- return 0;
- }
Add Comment
Please, Sign In to add comment