Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
bool behaviour (convertion/promotion) for logical and artihmetic operators
//Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23506 for x86 #include <iostream> int main() { bool b1 = 2, b2 = 4; bool result; std::cout << "true:" << true << " false: " << false << " b1(2): " << b1 << " b2(4):" << b2 << "\n\n"; result = b1 & b2; std::cout << std::boolalpha << b1 << " & " << b2 << " = " << result << "; "; std::cout << std::noboolalpha << b1 << " & " << b2 << " = " << result << '\n'; result = b1 | b2; std::cout << std::boolalpha << b1 << " | " << b2 << " = " << result << "; "; std::cout << std::noboolalpha << b1 << " | " << b2 << " = " << result << '\n'; result = b1 && b2; std::cout << std::boolalpha << b1 << " && " << b2 << " = " << result << "; "; std::cout << std::noboolalpha << b1 << " && " << b2 << " = " << result << '\n'; result = b1 || b2; std::cout << std::boolalpha << b1 << " || " << b2 << " = " << result << "; "; std::cout << std::noboolalpha << b1 << " || " << b2 << " = " << result << '\n'; }
run
|
edit
|
history
|
help
0
Replace all spaces in a string in C++
calling convention is part of type(?)
MSVC C2888 bug
#10.1
std override
C++ move/copy constructor and assignment demo
#30.3
Error log b is an undeclared identifier...
Hangman
Spirit Lex combining token_id's with semantic actions