C++ Question
XZGohan
Scottsdale, Arizona Member
ok...
code:
Im trying to make prayerlevel = 0 if it is below 0, negative, if its above 0 it will make itself to be that number.
That above is my lame attempt at doing something like it, however it doesnt work, of course
Wtf am I doing wrong? lol. I hate being a noob at things. :o
Thanks.
code:
... cout<<"Ranged Level "; cin>>rangedlevel; rangedlimit = (attacklevel + strengthlevel) / 1.475; rangedpurity = rangedlevel - rangedlimit; //if negative = 0 rangedamount = 0>rangedpurity ? 0 : rangedpurity; combatlevel = ((attacklevel + defenselevel + strengthlevel + hitpointslevel) / 4) + ((magiclevel + prayerlevel + rangedamount) / 8); ...
Im trying to make prayerlevel = 0 if it is below 0, negative, if its above 0 it will make itself to be that number.
That above is my lame attempt at doing something like it, however it doesnt work, of course
Wtf am I doing wrong? lol. I hate being a noob at things. :o
Thanks.
0
Comments
Also, for the life of me, I cannot figure out why primary/secondary are working right. o_O
make int prayerlevel if you have declare it an unsigned int prayerlevel which makes go to 0 to 65535.
here is my second solution but it has more code:
if (prayerlevel < 0 )
{prayerlevel = 0;}
I hope that helps (and works)!
Thanks Tropical
if you want it condensed, then use the ternary operator like you did w/ one of the ranged variables.
prayerlevel = ((prayerlevel > 0) ? prayerlevel : 0);