2009年5月30日

//******************************************/
//十进制数转换为其他进制数值
//运用函数递归栈,而不直接使用栈来实现
//******************************************/

#include
<iostream>
using namespace std;

// x表示要转换的十进制书,N表示你要转换的进制数!!
void Convert(int x,int N) 
{

    
if(x==0return;
    
else
    {    
        Convert(x
/N,N);
        cout
<<x%N;
    }
}

//******************************************
int main()
{

    
int x ,N;//x 表示要转换的数值,N表示进制
    cout<<"input the number first and then the number system :\n";
    cin
>>x>>N;
    Convert(x,N);
    
return 0;
}
posted @ 2009-05-30 14:39 longe 阅读(169) | 评论 (0)编辑 收藏
仅列出标题  

导航

<2026年6月>
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011

统计

常用链接

留言簿

随笔档案

搜索

最新评论