64,654
社区成员
发帖
与我相关
我的任务
分享
#include < stdio.h >
long a = 10000 ,b = 0 ,c = 2800 ,d,e,f[ 2801 ],g;
void main()
{
printf( " %d " ,b);
for (;b != c;)
{
f[b] = a / 5 ;
b ++ ;
}
for (; d = 0 ,g = c * 2 ; c -= 14 ,printf( " %.4d " ,e + d / a),e = d % a)
for (b = c;d += f[b] * a,f[b] = d %-- g,d /= g -- , -- b;d *= b);
}
#include <iostream>
using namespace std;
void Convert(unsigned int n, int base, int cnt)
{
if (!cnt--) return;
Convert(n/base, base, cnt);
if(base <= 10)
{
printf("%d", n%base);
}
else
{
int t = n%base;
printf("%c", t < 10 ? t + '0' : t - 10 + 'A');
}
}
int main()
{
Convert(65536, 2, 32);
puts("");
Convert(65536, 8, 32);
puts("");
Convert(65536, 10, 32);
puts("");
Convert(65536, 16, 32);
puts("");
return 0;
}