+ 1

Give me examples of codes having variable Boolean,double and single and (!) symbol also plz put the outputs. language is c++

26th Dec 2018, 3:37 PM
Jonny Walker
Jonny Walker - avatar
2 Answers
+ 2
#include <iostream> using namespace std; int main() { double a = 10.6286; bool b = false; if (!(b)){ cout << a; } return 0; } Output : 10.6286 Here, this (!) is sign of not, which reverse any result, if it is true it will reverse to false or if result is false it will reverse to true. That's what I did here. if(!(b)){ cout << a; } Here, value of b is false and the not sign will make it true so it will print the value of a.
26th Dec 2018, 3:50 PM
Raj Chhatrala
Raj Chhatrala - avatar
0
Thnx Raj
26th Dec 2018, 5:11 PM
Jonny Walker
Jonny Walker - avatar