BufferedReader bf = new BufferedReader(new ImputStreamReader(System.in));
System.out.println("請輸入育產生之亂數:");
try{
String ss = bf.readLine();
int num = Integer.valueOf(ss);
int[] rnd = new int[num];
for(int i = 0; i < num; i++){
rnd[i] = (int)(Math.random()*1000);
for(int i1 = 1 ; i1 < num; i1++){
for(int j = 0; j < i; j++){
if(rnd[j] > rnd[i])
int t = rnd[j];
rnd[j] = rnd[i];
rnd[i] = t;
}for(int i2 = 0; i2 < num; i2++)
System.out.printf("%3d\t" + rnd[i]);
}
}
}catch(Exception e)
{
System.out.println("請輸入一個正整數");
}
}
}
複製代碼
作者: 許逸瑋 時間: 2012-9-3 23:02
Exception in thread "main" java.lang.Error: Unresolved compilation problems: " x8 {! _) L9 A7 k) H# I( S ImputStreamReader cannot be resolved to a type* p5 m& o. G5 C6 q+ c
Syntax error on token "int", delete this token; P8 y* O/ {% h r; c8 W4 n
t cannot be resolved to a variable ! Q$ \* G% c& W t cannot be resolved to a variable / L% O* d# l/ `6 b! Y" \% B& _; D4 t. v* i: S5 Q( H
at TQC103.main(TQC103.java:4)作者: ray 時間: 2012-9-5 23:24
Unresolved compilation problems: 1 O! D' ?( S2 g$ ~1 h
ImputStreamReader cannot be resolved to a type1 U& a |" _4 g" M* S: M
正確的寫法如下:/ [, q; o( I# _2 b
InputStreamReader !!