0
How can i compare two numbers?
I want to compare two numbers,with the: "if" function. How can i write it? In C++
6 odpowiedzi
+ 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
0
Ahaa. Ok thank you so much. I hope that i will succed to make the program.
0
Yeah...but...yeah. thanks for helping
0
One more thing, be careful about floating/decimal points. Precision and type may vary your answer.
0
Dattebayo