Checking if inputtext is 4 digits.
#10

Quote:
Originally Posted by Crayder
Посмотреть сообщение
False, it will not bug out. If you want to print the leading zero's you can easily do so.



You shouldn't use two sscanf strings for that. If you'd do it like I said it would be better. It's your code however, do as you will.

Now about the leading zero's. You shouldn't store it as a string to get them. You said:The correct way to do this would be this (example):
pawn Код:
printf("This number will have three leading zeros: %4i", 0);
//Output: "This number will have three leading zeros: 0000"

printf("These numbers will all be four digits, with leading zeros if needed: %4i, %4i, %4i", 12, 555, 045);
//Output: "These numbers will all be four digits, with leading zeros if needed: 0012, 0555, 0045"
Oh.. That's something new to me tbh.. :P
Reply


Messages In This Thread
Checking if inputtext is 4 digits. - by faff - 09.10.2015, 20:54
Re: Checking if inputtext is 4 digits. - by ThePhenix - 09.10.2015, 20:56
Re: Checking if inputtext is 4 digits. - by Crayder - 09.10.2015, 21:00
Re: Checking if inputtext is 4 digits. - by faff - 09.10.2015, 21:01
Re: Checking if inputtext is 4 digits. - by faff - 09.10.2015, 21:06
Re: Checking if inputtext is 4 digits. - by faff - 09.10.2015, 21:15
Re: Checking if inputtext is 4 digits. - by Ahmad45123 - 09.10.2015, 21:19
Re: Checking if inputtext is 4 digits. - by faff - 09.10.2015, 21:40
Re: Checking if inputtext is 4 digits. - by Crayder - 09.10.2015, 21:53
Re: Checking if inputtext is 4 digits. - by Ahmad45123 - 09.10.2015, 22:08

Forum Jump:


Users browsing this thread: 1 Guest(s)