看板 C_and_CPP 關於我們 聯絡資訊
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)DEV CPP 額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)stdio.h和stdlib.h 問題(Question):我寫了一個程式(程式碼如下),但是在"輸入[9][5]"之後就跳掉了 餵入的資料(Input):#include <stdio.h> #include <stdlib.h> int main() { int a, b, c; int num[9][9]; for(a=0; a<=9; a++) { for(b=0; b<=9; b++) { printf("請輸入[%d][%d]\n", a, b); scanf("%d", &num[a][b]); printf("[%d][%d]=%d\n", a, b, num[a][b]); } } for(a=0; a<=3; a++) { for(b=0; b<=2; b++) { printf("[%d][%d]=%d\n", a, b, num[a][b]); } } system("PAUSE"); return 0; } 預期的正確結果(Expected Output):程式叫我輸入100個數,之後就把他們全部印在畫面上 錯誤結果(Wrong Output):在"輸入[9][5]"後又回到"輸入[9][2]" 程式碼(Code):(請善用置底文網頁, 記得排版)與上面一樣 補充說明(Supplement): -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 118.168.57.83 ※ 文章網址: http://www.ptt.cc/bbs/C_and_CPP/M.1409835723.A.0FA.html
putumaxally: 0~9是10個 09/04 21:03
flydragon198: 你的陣列大小是[9][9],你怎麼能輸入[9][5]? 09/04 21:04
iloveyouever: ARRAY宣告之後的大小要先搞清楚 09/04 22:08
future314: int num[9][9]意思是9*9的矩陣喔 不是10*10 09/04 22:35