Board logo

標題: ?? [打印本頁]

作者: 許逸瑋    時間: 2012-9-3 23:01     標題: ??

  1. import java.io.BufferedReader;
  2. public class TQC103 {
  3.         public static void main(String[] args) {
  4.         BufferedReader bf = new BufferedReader(new ImputStreamReader(System.in));
  5.         System.out.println("請輸入育產生之亂數:");
  6.         try{
  7.                 String ss = bf.readLine();
  8.                 int num = Integer.valueOf(ss);
  9.                 int[] rnd = new int[num];
  10.                 for(int i = 0; i < num; i++){
  11.                         rnd[i] = (int)(Math.random()*1000);
  12.                         for(int i1 = 1 ; i1 < num; i1++){
  13.                                 for(int j = 0; j < i; j++){
  14.                                         if(rnd[j] > rnd[i])
  15.                                         int t = rnd[j];
  16.                                         rnd[j] = rnd[i];
  17.                                         rnd[i] = t;
  18.                                 }for(int i2 = 0; i2 < num; i2++)
  19.                                 System.out.printf("%3d\t" + rnd[i]);
  20.                         }
  21.                 }
  22.         }catch(Exception e)
  23.         {
  24.                 System.out.println("請輸入一個正整數");
  25.         }

  26.         }
  27. }
複製代碼

作者: 許逸瑋    時間: 2012-9-3 23:02

Exception in thread "main" java.lang.Error: Unresolved compilation problems: $ |- ]: ~, p( g6 X" ?5 g
        ImputStreamReader cannot be resolved to a type0 D8 t' K& B3 t! G# j
        Syntax error on token "int", delete this token
6 X4 E2 ]- m7 C/ v" d0 X: ]        t cannot be resolved to a variable& i5 s# L1 a! V9 i  B
        t cannot be resolved to a variable
5 Z! z4 u0 ^# C% R* L0 j# T
1 Y6 x; E* ^2 p% ?8 ~        at TQC103.main(TQC103.java:4)
作者: ray    時間: 2012-9-5 23:24

Unresolved compilation problems: ' }; s* u/ I( U
ImputStreamReader cannot be resolved to a type3 E* d' t3 L0 c+ A" M" [& q4 e
正確的寫法如下:7 a$ ~6 D$ @& K' T4 d! I( A
InputStreamReader !!




歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/) Powered by Discuz! 7.2