一个类似于Excel标题栏的进制转换

inline void ColumnIndex_Num2Str(INT col, WCHAR* x)

{

 ++col;  size_t uLen = 0;

 while (col > 0)

 {

  x[uLen++] = WCHAR(‘A’) + (col – 1) % 26;

  col = (col – 1) / 26;

 }

 std::reverse(x, x+uLen);

 x[uLen] = 0;

}

点赞