将10进制数转换为任意进制数进行显示
2011-04-29 10:41
423 查看
/* ************************************************************************ * Filename: test.c * Description: 将10进制数转换成为其他任意进制数 * Version: 1.0 * Created: * Revision: none * Compiler: gcc * Author: wen hao * Company: * ************************************************************************/ #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> int M; void showhex(int n) { if(n>(M-1)) { showhex(n/M);//递归调用 } printf("%d",n%M); } int main(int argc, char *argv[]) { int n; if(argc < 2) { printf("please input two parament\n"); sleep(1); return 0; } M = atoi(argv[1]);//将第二个参数,转换为int型 while(1) { printf("\rplease input Decimal number:"); scanf("%d",&n); showhex(n); printf("\n"); } return 0; }
这里是运行结果:
相关文章推荐
- 10进制到任意进制的转换
- Linux下的C语言编程——10进制转换成任意进制的字符串
- java中进行2、8、16、10进制之间的转换
- JAVA进行进制转换,10进制转换为其他进制
- 使用Python进行新浪微博的mid和url互相转换实例(10进制和62进制互算)
- c# 关于10进制和16进制转换以及显示
- 10进制向任意进制的转换
- 使用链栈来对十进制数进行任意进制的转换
- Python 10进制与任意进制之间相互转换(最大为62进制)
- 《数据结构》10进制的数向任何进制的数进行转换
- java中进行2、8、16、10进制之间的转换
- 2011-02-23 00:18 java中进行2、8、16、10进制之间的转换
- 用sql server进行10进制和16进制的转换 hextoint inttohex
- 将任意进制(2~36)的数转换为10进制,参数k=16就是16进制转10进制
- 使用Python进行新浪微博的mid和url互相转换实例(10进制和62进制互算)
- 将10进制数转换成任意进制数
- 14.2线性表之STL实现10进制向任意进制的转换
- 输入一串数字转换为2,4,6,8,10,16任意进制数字
- java中进行2、8、16、10进制之间的转换