0

How can i compare two numbers?

I want to compare two numbers,with the: "if" function. How can i write it? In C++

18th Dec 2020, 7:53 PM
Chis Alex
Chis Alex - avatar
6 ответов
+ 3
The syntax is: If ( Boolean expression ) { Do something } Assuming two numbers: 3 and 5. The boolean expression will be: 3 == 5 So If(3==5) { Here you write what you want to do if its true } Else { Here you write what you want to do if its false (its optional) } In a Boolean expression you use == instead of = to differ it from placement ordinance
18th Dec 2020, 8:16 PM
aviad59
aviad59 - avatar
0
Ahaa. Ok thank you so much. I hope that i will succed to make the program.
18th Dec 2020, 8:23 PM
Chis Alex
Chis Alex - avatar
0
Yeah...but...yeah. thanks for helping
18th Dec 2020, 9:25 PM
Chis Alex
Chis Alex - avatar
0
One more thing, be careful about floating/decimal points. Precision and type may vary your answer.
19th Dec 2020, 7:36 AM
Akib
Akib - avatar
0
Dattebayo
22nd Apr 2021, 7:28 AM
UzumakiNaruto
UzumakiNaruto - avatar