爱嘉牛LA

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
#include<iostream>
using namespace std;
int BaseTrans(int data,int B){
    int s;
    if(data==0)
       return 0; //结束递归算法 
    s=data%B;
    BaseTrans(data/B,B);
    cout<<s<<" ";
}
int main(){
    int data=15,
        B=2;//指定要转换成的数 
    BaseTrans(data,B);
    return 0;
}
View Code

 

posted on 2013-12-21 23:10  爱嘉牛LA  阅读(321)  评论(0编辑  收藏  举报