開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
Dev-C++
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
NO 只有基本的 include <stdio.h>
問題(Question):
抓陣列取值有時會出錯
餵入的資料(Input):
預期的正確結果(Expected Output):
如圖。陣列值都是一。
錯誤結果(Wrong Output):
可是當N 變大時等於60, 他會出現 2292658 這種怪數字。
可是 N=99 又沒問題。 不知道為什麼,求大師解救。
程式碼(Code):(請善用置底文網頁, 記得排版)
#include <stdio.h>
#define N 60
int main(){
int score1[N],score2[N];
int i,j,s=0,ds=0;
// 輸入兩個長度100的數列
for (i=1;i<=N;i++){
score1[i]=1,score2[i]=1 ;
printf("%6d\n",score1[i]);
printf("%6d\n",score2[i]);
printf("%6s\n","