help with coding assignment | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

help with coding assignment

Write the output of the following cout statements, showing the steps of your work. auto value_1 = -1, value_2 = -4, value_3 = 9; if (value_1 == value_2 || value_3 / 3 > value_2) { if (value_1 - 2 * value_2 == 1) cout << "A"; else if (value_3 * -1 > 0) cout << "B"; } else { cout << "C"; }

3rd Nov 2020, 1:07 AM
heysisters
2 Answers
+ 3
If a comparison is true, it returns 1 If it's false, it returns 0 5 < 3 ---> false, also called 0 5 > 3 ---> true, also called 1 When as a condition to enter a block of code you have something false (also called 0) the block is not executed. If as a condition you have something true (also called 1) or any other number that is not 0, then the program enter the block. If(0) { ... } The program skip it If(-91) { ... } The program enter the block of code and executes it's instructions
3rd Nov 2020, 1:31 AM
Davide
Davide - avatar
+ 2
heysisters , what do you think output should be ?
3rd Nov 2020, 1:09 AM
Arsenic
Arsenic - avatar