数的读法c语言程序,数的读法.c · zhuweishan/蓝桥杯 - Gitee.com

#include

#include

enum

{

GW =0 ,

SW =1 ,

WW =4 ,

SWW=5 ,

YW =8 ,

SYW=9 ,

};

void du(int);

void q_wq(int *,int *,int);

void du1wei(int,int,int *,bool);

void du_qw0(int ,bool);

void du_sz(int,int,int *,bool);

bool byd0(bool,int *);

bool byd1(bool,int);

void du_wm(int,int,int);

bool bydw(int,int,int);

bool jixudu(int,int);

int main(void)

{

int szc;

scanf("%d",&szc);

du(szc);

return 0;

}

bool jixudu(int sxs,int wx)

{

if(sxs!=0)

{

return true;

}

if(wx!=WW&&wx!=YW&&wx!=GW)

{

return true;

}

return false;

}

bool bydw(int sz,int wx, int qw0gs)

{

if(sz!=0)

{

return false;

}

if(wx!=WW&&wx!=YW)

{

return true;

}

if(qw0gs<4)

{

return false;

}

return true;

}

void du_wm(int sz,int wx, int qw0gs)

{

if(bydw(sz,wx,qw0gs)==true)

{

return ;

}

static char const * weidf[]={"","shi","bai","qian","wan","shi","bai","qian","yi","shi"};

printf("%s ",weidf[wx]);

}

bool byd1(bool zgw,int wx)

{

if(zgw==false)

{

return false;

}

if(wx==SW||wx==SWW||wx==SYW)

{

return true;

}

return false;

}

bool byd0(bool zgw,int *p_qw0gs)

{

if(zgw==false)

{

++ * p_qw0gs;

return true;

}

return false;

}

void du_sz(int sz,int wx,int *p_qw0gs,bool zgw)

{

if(sz==0)

{

if(byd0(zgw,p_qw0gs)==true)

{

return ;

}

}

*p_qw0gs=0;

if(sz==1)

{

if(byd1(zgw,wx)==true )

{

return ;

}

}

static char const * szdf[10]={"ling","yi","er","san","si","wu","liu","qi","ba","jiu"};

printf("%s ",szdf[sz]);

}

void du_qw0(int sz,bool zby0)

{

if(sz==0)

{

return ;

}

if(zby0==false)

{

return ;

}

printf("ling ");

}

void du1wei(int sz,int wx,int *p_qw0gs,bool zgw)

{

du_qw0(sz,*p_qw0gs>0);

du_sz(sz,wx,p_qw0gs,zgw);

du_wm(sz,wx,*p_qw0gs);

}

void q_wq(int *p_wx,int *p_qn,int s)

{

*p_wx=0;

*p_qn=1;

while(s>9)

{

++*p_wx;

*p_qn*=10;

s/=10;

}

}

void du(int s)

{

int wx;

int quan;

q_wq(&wx,&quan,s);

int qw0gs=0;

bool zgw=true;

do

{

du1wei(s/quan,wx,&qw0gs,zgw);

zgw=false;

s%=quan;

quan/=10;

}

while(jixudu(s,wx--)==true);

}

一键复制

编辑

Web IDE

原始数据

按行查看

历史

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值