Let say I have two ints
a = 1234 b = 45678
Now I want to "interlace" them into a third int c that looks something like this c = 415263748 assume the the length of these don't change. So far I've been able to do this:
unsigned interlace(unsigned x, unsigned y) { unsigned pow = 10; while(y >= pow) pow *= 10; return x * pow + y; } https://stackoverflow.com/questions/65866959/how-to-interlace-two-integers-in-c January 24, 2021 at 11:47AM
没有评论:
发表评论