Datahub
数据改变生活

1871: 念数字

发表时间:2022-10-27 19:38

1871: 念数字

时间限制: 1 Sec   内存限制: 128 MB

题目描述

输入一个整数,输出每个数字对应的拼音。当整数为负数时,先输出“fu”字。十个数字对应的拼音如下:

0: ling

1: yi

2: er

3: san

4: si

5: wu

6: liu

7: qi

8: ba

9: jiu

输入

输入在一行中给出一个整数,如:1234。

提示:整数包括负数、零和正数。

输出

输出这个整数对应的拼音,每个数字的拼音之间用空格分开,行末没有最后的空格。如yi er san si。

样例输入 Copy

-600

样例输出 Copy

fu liu ling ling

#include<bits/stdc++.h>

using namespace std;

int main(){

char ch[505];

scanf("%s",ch);

int l=strlen(ch);

for(int i=0;i<l;i++)

if(ch[i]=='-') printf("fu ");

else if(ch[i]=='0') printf("ling ");

else if(ch[i]=='1') printf("yi ");

else if(ch[i]=='2') printf("er ");

else if(ch[i]=='3') printf("san ");

else if(ch[i]=='4') printf("si ");

else if(ch[i]=='5') printf("wu ");

else if(ch[i]=='6') printf("liu ");

else if(ch[i]=='7') printf("qi ");

else if(ch[i]=='8') printf("ba ");

else if(ch[i]=='9') printf("jiu ");

return 0;

}


文章分类: 算法例题
分享到:
QQ:258506508                                     联系电话:020-000000    000-000000                                   联系邮箱:xxx@.co.m                                     联系地址:XXX省XXX市XXX县XXX路