#include<iostream.h>#include<math.h>intmain(){charch[16]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'},output[20];intinput,temp,n,i=0;cout<<"請輸入你想要轉換的十進制數:";cin>>input;cout<<"請輸入要轉換的進制(2<=n<=16):";cin>>n;input=fabs(input);while(input){temp=input%n;input=input/n;output[i++]=ch[temp];}output[i]='\0';cout<<"轉換為"<<n<<"進制后為:";for(;i>=0;i--)cout<<output[i];cout<<endl;return0;}
網站導航
- zblogPHP模板zbpkf
- zblog免費模板zblogfree
- zblog模板學習zblogxuexi
- zblogPHP仿站zbpfang