得到int每位数字
int n;
string s = "";
while(n>0){
s = n%10+s;
}
应用:Integer to Roman
int unit[] = {1000,900,500,400,100,90,50,40,10,9,5,4,1};
string roman[] = {"M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"};
int count;
string res;
for(int i=0;num>0;i++){
count = num/unit[i];
num = num%unit[i];
for(;count>0;count--){
res = res+roman[i];
}
}