Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void itoa_krd(const int & val, char *buf) {
- char t0[sizeof(int) * 4] = {};
- char *s = buf, *t = t0 + sizeof(t0) - 2;
- std::div_t qr;
- qr.quot = val;
- do {
- qr = std::div(qr.quot, 10);
- *(t--) = '0' + qr.rem;
- } while ((qr.quot != 0) || (qr.quot != 0));
- t++;
- do {
- *(s++) = *(t++);
- } while (*t);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement