Test boolean.
This commit is contained in:
parent
4eb93057a9
commit
f3a5a7668a
19
main.cpp
19
main.cpp
@ -2,15 +2,12 @@
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
double zero {0.0};
|
if(-1)
|
||||||
double posinf { 5.0 / zero }; // positive infinity
|
std::cout << "-1 is true\n";
|
||||||
std::cout << posinf << '\n';
|
if(2)
|
||||||
|
std::cout << "2 is true\n";
|
||||||
double neginf { -5.0 / zero }; // negative infinity
|
if(1)
|
||||||
std::cout << neginf << '\n';
|
std::cout << "1 is true\n";
|
||||||
|
if(!0)
|
||||||
double nan { zero / zero }; // not a number (mathematically invalid)
|
std::cout << "0 is false\n";
|
||||||
std::cout << nan << '\n';
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user