mirror of
https://github.com/libretro/cpp-cheat.git
synced 2025-04-12 08:14:07 +00:00
36 lines
444 B
C++
36 lines
444 B
C++
/*
|
|
# bool
|
|
|
|
in C++, unlike in C, bool is part of the language.
|
|
*/
|
|
|
|
#include "common.hpp"
|
|
|
|
int main() {
|
|
bool b;
|
|
|
|
b = true;
|
|
b = 1;
|
|
|
|
if (true)
|
|
{
|
|
assert(true);
|
|
}
|
|
if (false)
|
|
{
|
|
assert(false);
|
|
}
|
|
|
|
{
|
|
std::stringstream oss;
|
|
oss << true;
|
|
assert(oss.str() == "1");
|
|
}
|
|
|
|
{
|
|
std::stringstream oss;
|
|
oss << false;
|
|
assert(oss.str() == "0");
|
|
}
|
|
}
|