C 實現的 阿拉伯數字轉換成中文大寫金額

2021-09-08 06:32:46 字數 1445 閱讀 3750

///

/// 轉換數字金額主函式(包括小數)

///

/// 數字字串

/// 轉換成中文大寫後的字串或者出錯資訊提示字串

public string convertsum(string str)

} ///

/// 判斷是否是正數字字串

///

/// 判斷字串

/// 如果是數字,返回true,否則返回false

public bool ispositvedecimal(string str)

catch(exception)

if(d>0)

return true;

else

return false; }

///

/// 轉換數字(整數)

///

/// 需要轉換的整數數字字串

/// 轉換成中文大寫後的字串

public string convertdata(string str)

else

else

if(strlen<=12)//數字長度大於八位,小於十二位

} strlen=rstr.length;

if (strlen>=2)

} return rstr; }

///

/// 轉換數字(小數部分)

///

/// 需要轉換的小數部分數字字串

/// 轉換成中文大寫後的字串

public string convertxiaoshu(string str)

else

} ///

/// 轉換數字

///

/// 轉換的字串(四位以內)

///

public string convertdigit(string str)

rstr=rstr.replace("拾零","拾");

strlen=rstr.length;

return rstr; }

///

/// 轉換四位數字

///

public string convert4digit(string str)

///

/// 轉換三位數字

///

public string convert3digit(string str)

///

/// 轉換二位數字

///

public string convert2digit(string str)

///

/// 將一位數字轉換成中文大寫數字

///

public string convertchinese(string str)

return(cstr); }

英文數字轉換成為阿拉伯數字

include include include include includeusing namespace std define debug int parse void else if 1 twice check flag,do sth,clear flag else j 0 buf j c b...

羅馬數字轉換成阿拉伯數字

羅馬數字 採用七個羅馬字母作數字 即 1 v 5 x 10 l 50 c 100 d 500 m 1000 記數的方法 1 相同的數字連寫,所表示的數等於這些數字相加得到的數,如 3 2 小的數字在大的數字的右邊,所表示的數等於這些數字相加得到的數,如 8 12 3 小的數字 限於 x 和 c 在大...

羅馬數字轉換成阿拉伯數字

roman to integer example 1 input cccl ix output 389dict儲存單個羅馬字母代表的阿拉伯數字 初始狀態sum 0,迴圈遍歷字串,如果s i 所代表的阿拉伯數字大於s i 1 的,則加到sum上,如果小於,則sum減去s i 代表的阿拉伯數字 clas...