📄 jinzhi.h
字号:
#ifndef jinzhi_h_
#define jinzhi_h_
double tentoother(double temp,int num)
{
int i,j;
double k=0;
double p=temp;
while(p!=0)
{
for(i=0;pow(num,i)<=p;i++)
{
j=i;
}
p=p-pow(num,j);
k+=1*pow(10,j);
}
return k;
}
double othertoten(double temp,int num)
{
int i,j;
double k=0;
double p=temp;
while(p!=0)
{
for(i=0;pow(10,i)<=p;i++)
{
j=i;
}
p=p-pow(10,j);
k+=1*pow(num,j);
}
return k;
}
CString tentoothers(double temp,int num)
{
int x=floor(temp);
int i,a[100];
for(i=0;x>0;i++)
{
a[i]=x%num;
x/=num;
}
CString cher;
for(;i>=0;i--)
{
if(a[i]<=9&&a[i]>=0)
{
cher+=a[i]+48;
}
if(a[i]<=15&&a[i]>=10)
{
cher+=a[i]+55;
}
}
return cher;
}
double otherstoten(CString str,int num)
{
int len=str.GetLength()-1;
if(len<0)return 0;
if(num==10)
return atof(str);
else
{
double ret=0;
for(int k=len;k>=0;k--)
{
if(str[k]>='0'&&str[k]<='9')
{
ret+=(str[k]-48)*pow(num,len-k);
}
if(str[k]>='A'&&str[k]<='F')
{
ret+=(str[k]-55)*pow(num,len-k);
}
}
return ret;
}
}
#endif //jinzhi_h_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -