+ 2
Why this code does not work?
I have this code in C++Ă if (vurusyukseklik<=0){cout<<"Hedef menzil disinda! \n";} if ((vurusyukseklik>0) && (vurusyukseklik<=0,9)){cout<<"Hedefi bacagindan vurdun! \n";} if ((vurusyukseklik>0,9) && (vurusyukseklik<=1,7)){cout<<"Hedefi govdesinden vurdun! \n";} if ((vurusyukseklik>1,7) && (vurusyukseklik<1,8)) {cout<<"Tam basindan vurdun! \n";} if (vurusyukseklik>1,8) {cout<<"Mermi hedefin uzerinden uctu gitti!";} When my vurusyukseklik value is 1.99983, the program prints out every output except the first one. Why does this happen?
8 Answers
0
Wow i found what is wrong! I was writing decimal numbers with comma, not dot :o
+ 3
Is vurusyukseklik an int? You need to define it float. Or double, if you want more precisity than 5 digits.
+ 2
Sry, I can't overview it because I'm so confused by your language.
+ 2
XD
+ 1
Yucuklu Sumurta you can use else-if ladder in such a condition
+ 1
I am not sure bc i dont understand your language
0
It is just a simple bullet simulator. It uses x=1/2*a*(t)^2 I tried to translate it: https://pastebin.com/Xwt6GTw2 I do not have problem with the main parts of the code but just with the comparison section ://// Here is the codeplayground link btw: https://code.sololearn.com/c22R8DT9J6H7/#cpp (tufekyukseklik is rifleheight)
0
i just wrote decimal numbers with comma xd