import java.io.*;
public class test12{
public static void main(String[] args)throws IOException {

BufferedReader input = new BufferedReader
(new InputStreamReader(System.in));

char c;
int c_total=0,num_total=0;
do
{
System.out.print("請輸入字元: ");
c=(char)input.read();
input.skip(2);
if(Character.isDigit(c))
num_total+=1;
else
c_total+=1;
while(true)
{
System.out.print("請問是否還要繼續輸入(Y/N): ");
c=(char)input.read();
input.skip(2);
if((c=='Y')||(c=='y')||(c=='N')||(c=='n'))
break;
}
}while((c=='Y')||(c=='y'));
System.out.println("您輸入的數字有"+num_total+"次");
System.out.println("您輸入的字有"+c_total+"次");
}
}
arrow
arrow
    全站熱搜

    Neo Chao 發表在 痞客邦 留言(0) 人氣()