天梯赛—念数字
实在无聊找找编程感觉package oneDay;
import java.util.Scanner;
public class ReadNum {
// 索引既是数字读法
static String[] str = { "ling", "yi", "er", "san", "si", "wu", "liu", "qi", "ba", "jiu" };
static String spe = "fu";
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String getThis = sc.next();
char[] fuhao = getThis.toCharArray();
if (getThis.charAt(0) != '-') {
for (int i = 0; i < getThis.length(); i++) {
if (i != getThis.length() - 1) {
System.out.print(str[(int) fuhao[i] - 48] + " ");
} else {
System.out.print(str[(int) fuhao[i] - 48]);
}
}
} else {
System.out.print("fu ");
for (int i = 1; i < getThis.length(); i++) {
if (i != getThis.length()-1) {
System.out.print(str[(int) fuhao[i] - 48] + " ");
} else {
System.out.print(str[(int) fuhao[i] - 48]);
}
}
}
sc.close();
}
}