c_cpp [十进制数转罗马数字]将一个十进制数字符串转换为罗马数字字符串#字符串处理

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了c_cpp [十进制数转罗马数字]将一个十进制数字符串转换为罗马数字字符串#字符串处理相关的知识,希望对你有一定的参考价值。

void DecimalToRomanNumber(char* dec) { //表示范围:1~3999
    char* com[4][9]= {
        {"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"}
    };
    for(int i = 0; dec[i]; i++) {
        printf("%s", com[strlen(dec) - i - 1][dec[i]-'0' - 1]);
    }
}

以上是关于c_cpp [十进制数转罗马数字]将一个十进制数字符串转换为罗马数字字符串#字符串处理的主要内容,如果未能解决你的问题,请参考以下文章

c_cpp [罗马数字转十进制数]接收罗马数字字符串,返回一个int型十进制数#字符串处理

c_cpp 罗马数字到十进制数

LeetCode 面试题 05.02. 二进制数转字符串

LeetCode 面试题 05.02. 二进制数转字符串

#yyds干货盘点# LeetCode程序员面试金典:二进制数转字符串

mysql如何把16进制转换成中文字符显示