const char charArr[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
char* ConvertToBase(int num, int base)
{
int len=0;
int n = num;
do len++; while((n/=base)!=0);
int i = len;
char* arr = new char[len+1];
do{
arr[--i]=charArr[num%base];
num/=base;
} while(num!=0);
arr[len] = '\0';
return arr;
}