void sljinzhi()
{
char a[M];
char *p1,*p2;
int n,i,t;
char c,c1;p1=a;
printf("\t\t\t10进制转为16进制\n");
printf("\t\t\t请输入一个数将转换成16进制:");
scanf("%d",&n);
while(n)
{
if((c1=(n%16))>=10)
switch(c1)
{
case 10:
c='A';break;
case 11:
c='B';break;
case 12:
c='C';break;
case 13:
c='D';break;
case 14:
c='E';break;
case 15:
c='F';break;
default :
printf("\n\n\n\t\t\t输入错误!\n\n\n");
}
else
c=n%16+'0';
if(1==n)
c=1+'0';
*p1++=c;
n/=16;
}
*p1='\0';
p2=a;
for(i=0;i<strlen(a)/2;i++)
{
t=*(p1-1);
*(p1-1)=*p2;
*p2=t;
p1--;
p2++;
}
printf("\n\n\n\t\t\t转换结果:%s\n\n\n",a);
}