Re: [問題] 請問如何讓C自動執行30次,並將結果輸ꔠ…

看板C_and_CPP作者 (都營大江戶線)時間15年前 (2010/05/04 23:13), 編輯推噓3(309)
留言12則, 2人參與, 最新討論串1/2 (看更多)
要呼叫的檔案是"1.5版.c" 希望將1.5版跑出來的The_Best和how_time 輸出到output #include<stdio.h> #include<stdlib.h> #include<math.h> #include<time.h> FILE *output=NULL; int main() { int B; float C; output=fopen("output.xls","w"); extern int*ini_M; 想請教,怎樣讓B等於程式"1.5版"裡的變數ini_M呢 fprintf(output,"%d\t%",B); extern float*how_time; fprintf(output,"%f\t%",C); fclose(output); system("PAUSE"); return 0; } 感謝先進提點了 >< -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.137.144.195 ※ 編輯: edoichi 來自: 220.137.144.195 (05/04 23:47)

05/04 23:55, , 1F
你直接print 1.5版 這串沒用""括?? compile都不會過吧??
05/04 23:55, 1F

05/04 23:56, , 2F
還有, "不能跑"這種描述基本上是很糟糕的描述, 請詳述怎
05/04 23:56, 2F

05/04 23:56, , 3F
麼不能跑, compile有錯??跑就沒回應??跑著就當了??等...
05/04 23:56, 3F

05/04 23:59, , 4F
加了""可以跑了 感謝 不過數字變很奇怪 我再研究看看 ><
05/04 23:59, 4F

05/05 00:00, , 5F
你用%d與%f來印"1.5版"?? 您可能要再研究一下fprintf的
05/05 00:00, 5F

05/05 00:01, , 6F
用法, 與那些%的東西和後面接的參數怎麼下怎麼對應@_@"
05/05 00:01, 6F

05/05 00:05, , 7F
我知道本來是接變數,不過剛找了一個小時都沒找到怎麼寫
05/05 00:05, 7F

05/05 00:07, , 8F
%d接整數, %f接浮點, %s接字串; "1.5版"相當於字串....
05/05 00:07, 8F

05/05 00:07, , 9F
但是, fprintf應該就是在印你的資料, 你印個"1.5版"這種
05/05 00:07, 9F

05/05 00:08, , 10F
東西進你的檔案幹麻?? "1.5版"這幾個字到底怎麼用啊?_?
05/05 00:08, 10F

05/05 00:10, , 11F
"1.5版.c" >< 要印出"1.5版.c"裡的ini_M等變數
05/05 00:10, 11F

05/05 00:10, , 12F
好像都沒找到類似問題 爬了整晚的精華區跟估狗了 XD
05/05 00:10, 12F
※ 編輯: edoichi 來自: 220.137.144.195 (05/05 00:21)
文章代碼(AID): #1Bu3cXt2 (C_and_CPP)
文章代碼(AID): #1Bu3cXt2 (C_and_CPP)