https://leetcode.com/problems/base-7/description/
class Solution {
public:
string convertToBase7(int num) {
string str;
if(num==0) return "0";
if(num<0) return "-" + convertToBase7(-num);
while (num>0) {
int a = num%7;
num = num/7;
str = to_string(a) + str;
}
return str;
}
};