+ 7

Usually get wrong outputs in C++, how to get it accurate?

for some exceptions i get it but in most of the cases my output in C++ goes wrong and sometimes its kinda stuck that how is this coming? please explain

16th Mar 2018, 11:15 AM
آفریں فاطمہ
آفریں  فاطمہ - avatar
8 Answers
+ 10
hello Afrin Fatima, to get a helpfull answer it will be better you show your code in your question, its possible to add a code to your question 👍😉
16th Mar 2018, 11:44 AM
tooselfish
tooselfish - avatar
+ 13
#include <iostream> using namespace std; int main() { int a = 1; int b = 0; cout<<(!(a||b))&&(!b); return 0; } copy this code in your codeplay ground and play a little bit with this code, delete one !, delete both !, delete the parenthesis and see what happen
16th Mar 2018, 12:49 PM
tooselfish
tooselfish - avatar
+ 9
@ Afrin Fatima, thank you very much for marking my answer as best 👍😉
16th Mar 2018, 12:19 PM
tooselfish
tooselfish - avatar
+ 9
the output is a boolean answer, because of the parenthesis, 0 = false and 1 = true, and because of the ! your output is 0
16th Mar 2018, 12:35 PM
tooselfish
tooselfish - avatar
+ 9
is this helpfull for you?
16th Mar 2018, 2:26 PM
tooselfish
tooselfish - avatar
+ 6
ok
16th Mar 2018, 12:17 PM
آفریں فاطمہ
آفریں  فاطمہ - avatar
+ 6
what is the output of this code? int a=1; int b= 0; cout<<(!(a||b))&&(!b);
16th Mar 2018, 12:19 PM
آفریں فاطمہ
آفریں  فاطمہ - avatar
+ 5
welcome:)
16th Mar 2018, 12:21 PM
آفریں فاطمہ
آفریں  فاطمہ - avatar