strval
#1

Hi guys...

I have Phone system with 9 numbers

Here is the code:
pawn Код:
new randphone = 100000 + random(899999);
format(stringbroj, sizeof(stringbroj), "071%d", randphone)
broj = strval(stringbroj)
printf("%d", broj)
When printing i get 71XXXXXX(8 numbers)... WHERE IS 0 (ZERO)
Reply
#2

pawn Код:
new randphone = 71000000;
randphone += (100000 + random(899999));
printf("%09d", randphone);
possible result: 071899588
Reply
#3

Because '0' in the beginning a whole number (in mathematics) has no meaning.

tho the solution of the guy above me is correct.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)