Re: [問題] File Merge sort

看板C_and_CPP (C/C++)作者時間16年前 (2009/03/25 01:37), 編輯推噓0(001)
留言1則, 1人參與, 最新討論串2/3 (看更多)
a檔案裡面是1,2,3 但寫進矩陣 讀出來只有1 程式如下: int main() { int a[2] ; int b[2] ; int c[5]; int i; int d[3]; FILE *fp; FILE *fp1; FILE *fp2; fp=fopen("D:\c.text","r"); //c 檔案裡面分別是 1,2,3 fscanf(fp,"%d",a); //將檔案中的資料讀取,並儲存在a陣列中。 printf("%d\n",a); //然後印出所讀到的資料。 fp1=fopen("D:\q.text","r"); //c 檔案裡面分別是 11,8,3 fscanf(fp1,"%d",a); //將檔案中的資料讀取,並儲存在b陣列中。 printf("%d\n",b); //然後印出所讀到的資料。 int sorted[2]={0}; mergesort(a,b,sorted,1,1); for (int i=0;i<2;i++) printf("%d",sorted[i]); getchar(); } 麻煩各位大大幫我check一下 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 118.169.86.206 ※ 編輯: d9003000 來自: 118.169.86.206 (03/25 01:38) ※ 編輯: d9003000 來自: 118.169.86.206 (03/25 01:38)

03/25 21:23, , 1F
存在b陣列的fscanf寫的是a耶?
03/25 21:23, 1F
文章代碼(AID): #19oHfRzk (C_and_CPP)
文章代碼(AID): #19oHfRzk (C_and_CPP)