當前位置:成語大全網 - 書法字典 - 數據字典程序

數據字典程序

導入Java . io . *;

公共類Test1 {

/**

* @param args

*/

公共靜態void main(String[] args) {

//數據字典!

Char c[]={ '零','壹','二','三','四','五','地','七','八','九' };

//等待輸入!

System.out.print("請輸入壹個阿拉伯數字:");

buffered reader br = new buffered reader(new InputStreamReader(system . in));

//獲取輸入!

嘗試{

string input = br . readline();

for(int count = 0;計數& ltinput.length()。count++){

//轉換成數字

char temp = input . charat(count);

開關(溫度){

case ' 1 ':system . out . print(c[1]);打破;case“2”:system . out . print(c[2]);打破;

case“3”:system . out . print(c[3]);打破;case“4”:system . out . print(c[4]);打破;

case“5”:system . out . print(c[5]);打破;case“6”:system . out . print(c[6]);打破;

case“9”:system . out . print(c[9]);打破;case“8”:system . out . print(c[8]);打破;

大小寫“0”:system . out . print(c[0]);打破;默認:break

}

}

} catch (IOException e) {

e . printstacktrace();

}

}

}