看板 java 關於我們 聯絡資訊
我在做八皇后問題的延伸 n皇后 private final int SIZE; 目前我只能用上述序列來定義 所需輸入的皇后數量 想改成程式能直接跑出下列 (run project) System.out.print("請輸入皇后數量?"); ------------------------------------------------- public static void main (String[] args) { int c=0; int r=0; System.out.print("幾位皇后?"); int s = new Scanner(System.in).nextInt(); nQueensBoard yy = new nQueensBoard (s); yy.canAddQueen(c,r); yy.trySquare(c,r); } 目前打這樣 不過會出現 location: class nQueensBoard nQueensBoard yy = new nQueensBoard (s); ^ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.26.210.104
superlubu:有 System.out 自然有 System.in 06/17 16:08
lvlightvivi:Scanner scanner = new Scanner(System.in); 06/17 16:11
tkcn:這標題很糟... 06/17 16:12
※ 編輯: curcus56304 來自: 114.26.210.104 (06/17 16:15) ※ 編輯: curcus56304 來自: 114.26.210.104 (06/17 16:18)
PsMonkey:==.=== 你問的問題根本跟八后問題沒關係... 06/17 16:22
PsMonkey:還有,請不要一個標題問到飽的作法,不然就當作業文處理 06/17 16:22
adrianshum:完全是發問的反面教材 06/17 17:02
liyard:nQueensBoard又是啥...? 06/18 01:31
bala045:變數取名應該要好一些 yy c r?? 06/18 13:39
tonylo2ooo:糟了 是十六層的世界奇觀 06/19 00:05
KanoLoa:有被騙進來的感覺orz 06/21 01:03