/*思路:是创建一个能存6个元素的数组,通过%和/来将输入的整数从左往右的每一位存入数组,然后再从右往左依次输出各位。
*变量:num数组存数,count来统计共存入了多少个元素,用来控制循环输出 */
package test;
import java.util.Scanner;
public class Main{
public static void main(String[] args) {
// TODO Auto-generated method stub
int[] num = new int[8];
Scanner in = new Scanner(System.in);
int number =in.nextInt();
int count;
int y;
if(number==0)
{
System.out.print("ling");
}
else {
if(number>=-100000&&number<=100000)
{
if(number<0) {
number=-number;
System.out.print("fu"+" ");
}
for(count=0;number!=0;count++)//从左往右循环输入各个数
{
y=number%10;
// System.out.print(y+" ");
num[count]=y;
number=number/10;
// System.out.println(count);
// System.out.println(num[count]);
}
// System.out.println(count);
for(;count!=0;count--) {
int digit=num[count-1];//循环输出数组中的各个数
switch(digit)
{
case 0:
System.out.print("ling");
break;
case 1:
System.out.print("yi");
break;
case 2:
System.out.print("er");
break;
case 3:
System.out.print("san");
break;
case 4:
System.out.print("si");
break;
case 5:
System.out.print("wu");
break;
case 6:
System.out.print("liu");
break;
case 7:
System.out.print("qi");
break;
case 8:
System.out.print("ba");
break;
case 9:
System.out.print("jiu");
break;
}
if(count!=1) //这是保证拼音间隔有空格,而最后一位拼音之后没有间隔
{
System.out.print(" ");
// System.out.print(count);
}
}
}
}
}
}
*变量:num数组存数,count来统计共存入了多少个元素,用来控制循环输出 */
package test;
import java.util.Scanner;
public class Main{
public static void main(String[] args) {
// TODO Auto-generated method stub
int[] num = new int[8];
Scanner in = new Scanner(System.in);
int number =in.nextInt();
int count;
int y;
if(number==0)
{
System.out.print("ling");
}
else {
if(number>=-100000&&number<=100000)
{
if(number<0) {
number=-number;
System.out.print("fu"+" ");
}
for(count=0;number!=0;count++)//从左往右循环输入各个数
{
y=number%10;
// System.out.print(y+" ");
num[count]=y;
number=number/10;
// System.out.println(count);
// System.out.println(num[count]);
}
// System.out.println(count);
for(;count!=0;count--) {
int digit=num[count-1];//循环输出数组中的各个数
switch(digit)
{
case 0:
System.out.print("ling");
break;
case 1:
System.out.print("yi");
break;
case 2:
System.out.print("er");
break;
case 3:
System.out.print("san");
break;
case 4:
System.out.print("si");
break;
case 5:
System.out.print("wu");
break;
case 6:
System.out.print("liu");
break;
case 7:
System.out.print("qi");
break;
case 8:
System.out.print("ba");
break;
case 9:
System.out.print("jiu");
break;
}
if(count!=1) //这是保证拼音间隔有空格,而最后一位拼音之后没有间隔
{
System.out.print(" ");
// System.out.print(count);
}
}
}
}
}
}