缘由 C语言 数组:数字过滤-CSDN问答
void chuli(int n=15236)
{
int aa[47]{0},j=0,m=0;
while(n)aa[j++]=n%10,n/=10;
while(j)if(aa[--j]%2)m*=10,m+=aa[j];
cout << m << ends;
}
void 数字过滤(int n = 15236)
{
int aa[47]{0}, j = 0, m = 0;
while (n || j)if (n)aa[j++] = n % 10, n /= 10; else if (aa[--j] % 2)m *= 10, m += aa[j];
cout << m << ends;
}
void 数字过滤(int n=123456789)
{
int sc = 0, j = 0, mo = 10;
if ((n % 10) % 2)sc = n % 10; else mo = 1;
while (n /= 10)if ((j = n % 10) % 2) j *= mo, sc = j + sc, mo *= 10;
cout << sc << ends;
}