Int x=4 ; cout <<x<<++x<<++x; the output is 666 why ? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 3

Int x=4 ; cout <<x<<++x<<++x; the output is 666 why ?

18th Dec 2016, 9:58 PM
Rana
Rana - avatar
3 Respostas
+ 6
because the two ++ operations takes predecence and ONLY AFTER them the x's are printed
18th Dec 2016, 10:07 PM
Burey
Burey - avatar
0
thanks šŸ˜Š
18th Dec 2016, 10:29 PM
Rana
Rana - avatar
0
switch the ++ to after the x that should produce the results I think you are looking for
19th Dec 2016, 3:38 AM
John V Jokoty III
John V Jokoty III - avatar