我的主页

快递查询 :http://m.kuaidi100.com     爱快递查询 :http://www.aikuaidi.cn/              

http://www.qtcn.org/bbs/u/168050  [收藏] [复制]

w642833823

  • 8

    关注

  • 25

    粉丝

  • 25

    访客

  • 等级:新手上路
  • 总积分:40
  • 保密,2011-12-07

最后登录:2020-07-06

更多资料

日志

转载——————————数字转大写

2020-06-17 11:10
//数字大小写转换
QString  Widget::numberToZh(int num)
{
QStringList zh = {"零","一","二","三","四","五","六","七","八","九","十"};
QString res = "";
if(num <= 10) {
    res = zh[num];
} else if(num < 20) {
    int  bits = num % 10;
    res = zh[10] + zh[bits];
} else if(num < 100) {
    int  bits = num % 10;
    int decade = num / 10;
    if(bits == 0) {
        res = zh[decade] + zh[10] + "整";
    } else {
        res = zh[decade] + zh[10] + zh[bits];
           }
      }
    else if(num > 100){
        res="只支持100以下数字";
    }


return res;
}
分类:QT|回复:0|浏览:54|全站可见|转载
 

下一篇:

上一篇: 转载延时函数 sleep

Powered by phpwind v8.7 Certificate Copyright Time now is:07-06 20:22
©2005-2016 QTCN开发网 版权所有 Gzip disabled