import java.io.*;
class Test
{
public static void main(String[] args) throws IOException
{
sop();
}
public static void sop() throws IOException
{
//创建一个缓冲输出流对象
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
char[] zhifu = {'零','一','二','三','四','五','六','七','八','九'};
int[] zhengxing = new int[1024];
int ch=0;
int cr=0;
int cc=0;
System.out.println("请输入一个整数!");
try
{
while((ch = in.read())!=-1)
{
if(ch=='\r')
{
continue;
}
if(ch=='\n')
{
while(zhengxing[cc]!=0)
{
//通过一个算法获取输入的相应int整数值
int q=(zhengxing[cc++]+2)%10;
System.out.print(zhifu[q]);
}
System.out.println("");
continue;
}
if(ch<48||ch>57)
{
System.out.println("你的输入不是一个整数");
sop();
}
else
{
zhengxing[cr++]=ch;
}
}
}
catch (IOException e)
{
System.out.println(e.toString());
}
}
}
|