Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

我用的是readline()然后用null来判断输入结束?

Posted by luopan0021 at 2004-11-02 13:08:35 on Problem 1588
In Reply To:对了,你要多帮帮用java的新人啊 Posted by:hawk at 2004-11-02 12:40:14
我是这样做的:
 BufferedReader iner = new BufferedReader(new InputStreamReader(System.in));
	     
        while(true){
        try{        	
         	     rom=iner.readLine();  
         	     if(rom==null)break;          	     
         }catch(IOException e){}            
	     n=rom.charAt(0);	     
	     switch(n){
	     case '+':Add();break;
	     case '-':Sub();break;
	     case '*':Rid();break;
	     case '/':Div();break;
	     case '=':Printer();break; 
	     default: number=Getroma(rom);
	              if(number>0&&number<4999)
	              st.push(Integer.toString(number));
	              else ender+="out of range exception\n";	              
	              break;
	     	     };	
	 	}	 	

我自己测试了很多没有错,也提交了很多次但是总是WA,所以我想是不是我判定输入结束的方法错了,谢谢,指教:)

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator