02.01.2014, 23:25
First of all nice explanation, I read whole of the thread and I understood most of it, but you made some errors, you are using
Float tag but you are using %i/%d(Integer/Decimal) placeholder instead of %f (Float), you will also
get an error if you tried and compiled your code.
Error
Let me elaborate what Babul said, he said the modulo operator returns 2 (two) remainder of integer
you simply need to change the formala, as shown above.
Fixed Code
- Correct me if I made something wrong.
Float tag but you are using %i/%d(Integer/Decimal) placeholder instead of %f (Float), you will also
get an error if you tried and compiled your code.
Error
Code:
error 004: function "operator%(Float:,_:)" is not implemented
Quote:
the modulo operator returns the remainder of 2 integers. for floats, you simply need to reinvent the formula:
pawn Code:
pawn Code:
|
you simply need to change the formala, as shown above.
Fixed Code
pawn Code:
new age, an; //declare a new float and an integer called "an"
an = age % 10; //calculate the age in 10-year anniversary terms (look E1)
if(an == 0) //asks if an is 0 (look E2)
{
print("Congratulations on your anniversary!");
}
pawn Code:
new minutes, seconds; //declare a new float and an integer (look E1)
seconds = minutes % 60; //calculate modulo (look E2)
minutes = floatround(minutes, floatround_floor); //make the minutes become an integer (look E3)
printf("Time left: %i,%i", minutes, seconds);