description: the shaping data into Roman characters, only that 1-3999
Solution: Roman characters include all two-dimensional array, and then shaping the Roman character data corresponding to each bit to find
string intToRoman(int num){
string res;
string vec[4][10] = { {"", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"},
{"", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC"},
{"", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM"},
{"", "M", "MM", "MMM"}
};
int i = 0;
while (num) {
int temp = num % 10;
res = vec[i][temp] + res;
num /= 10;
++i;
}
return res;
}