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

Runtime Error

Posted by 09316261690 at 2010-03-29 21:18:42 and last updated at 2010-03-29 21:18:59
是3749啊,下面是代码:提示说:Runtime Error

import java.util.Scanner;
public class Main{
public static void main(String[ ] args)
 { 
      System.out.println("START");
      String string1=caesar(); 
      System.out.println("END");
      System.out.println("START");
      String string2=caesar(); 
      System.out.println("END");
     System.out.println("START");
      String string3=caesar(); 
      System.out.println("END");
       System.out.println(string1);
       System.out.println(string2);
       System.out.println(string3);
 }
 public  static int searchIndex(char ch)
    {
    int i=0,k=0;
    char[] array={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
      while(i<26)
         {
           if(ch==array[i])
              {
               k=i;
               break; 
               }
           else
               i++;
         }
         return k;
     }
public static String caesar()
{
Scanner scan=new Scanner(System.in);
   String ciphertext=scan.nextLine();
   char[] array=ciphertext.toCharArray();
   char[] alphabet={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
   int index,j;
    for(j=0;j<array.length;j++)
     {
       if(!(array[j]>='A')&&(array[j]<='Z'))
          continue;
       else
         { 
           index=searchIndex(array[j]);
           index=index-5; 
           if(index>=26)
               index=index-26;
             if(index<0)
               index=index+26;
               array[j]=alphabet[index];           
          }
     }
     String str=new String(array);
     return str;
}
}
 到底怎么回事啊?、等待大牛的解答!谢谢诶

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