您的位置:首页 > 其它

输入一个十进制正整数,将其转换成二进制、八进制、十六进制数输出

2007-01-19 17:27 369 查看
1、形参采用指针

#include "stdio.h"
#include "conio.h"
#include "string.h"
void main()

void trans10_2_8_16(char *p,long m,int base)
#include "stdio.h"
#include "conio.h"
#include "string.h"
void main()

void trans10_2_8_16(char a[],long m,int base)
{
int r;
while(m>0)
{
r=m%base;
if(r<10) *a=r+48;
else *a=r+55;
m=m/base;
a++;
}
*a='\0';
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐