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

好像用hasNext可以吧

Posted by jackjack at 2005-08-10 16:00:36 on Problem 1939
In Reply To:请教一下用java如何结束输入(hasnextint()这个函数是错的) Posted by:ylsq at 2005-08-10 14:40:23
> 我做这题目提交一直是提示Runtime Error不知道是哪的问题,请各位帮忙看一下:
> import java.io.*;
> import java.util.*;
> public class Main
> {
> 	public static void main(String arg[])throws Exception
> 	{
> 		Scanner cin=new Scanner(System.in);
> 					
> 		while(cin.hasNextInt())
> 		{int n=cin.nextInt();
> 		
> 			float[] resx=new float[n];
> 			float [] resy=new float[n];
> 			int prex=cin.nextInt();
> 			int stox=prex;
> 			int prey=cin.nextInt();
> 			int stoy=prey;
> 			for(int i=0;i<n-1;i++)
> 			{
> 				int x=cin.nextInt();
> 				int y=cin.nextInt();
> 				.........
> 			}
>                            ........
> 		}
> 	}
> }

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