📄 digitcheng.cpp
字号:
// DigitCheng.cpp: implementation of the DigitCheng class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "练习.h"
#include "DigitCheng.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
DigitCheng::DigitCheng()
{
}
CString DigitCheng::Chenge(const int num){
CString str;
CString temp;
if(num<10){
str="0";
temp.Format("%d",num);
str+=temp;
}
else if(num<16){
str="0";
str+=Detect(num);
}
else{
int p=num/16;//十位
temp.Format("%d",p);
str=temp;
p=num%16;//个位
str+=Detect(p);
}
return str;
}
CString DigitCheng::Detect(const int num){
CString temp;
if(num<10){
temp.Format("%d",num);
return temp;
}
else{
switch(num){
case 10:
return ("A");
break;
case 11:
return ("B");
break;
case 12:
return ("C");
break;
case 13:
return ("D");
break;
case 14:
return ("E");
break;
case 15:
return ("F");
break;
default:
return ("A");
break;
}
}
}
DigitCheng::~DigitCheng()
{
}
CString DigitCheng::RightToDiverse(CString src)
{
int length=src.GetLength();
int i;
char ca,cb;
CString temp=src;
if(length%2!=0){
temp+="F";
length++;
}
for(i=0;i<length-1;i+=2){//交换字符
ca=temp.GetAt(i);
cb=temp.GetAt(i+1);
temp.SetAt(i,cb);
temp.SetAt(i+1,ca);
}
return temp;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -