[問題] 讀檔問題>"<有附程式連結 幫忙一下
http://140.130.175.96/help.rar
程式碼連結在上面 , 裡面也有讀檔的檔案
問題大概是我沒辦法將檔案中的數字讀出來....
顯示出來的都是0,不然就是極大的數目
不知道哪裡出了問題>"<
可以麻煩幫我看一下嗎?
附上原始碼
#include <stdio.h>
#define FILENAME "Table_old.txt"
main() {
宣告省略 太長嚕>"<詳細看連結裡面有
int r,s,t,u;
FILE *fp;
int c;
if ((fp = fopen(FILENAME, "r")) == NULL)
printf("File is not readable.\n");
else {
for ( r = 0; r < state_speed_size; r++) {
for ( s = 0; s < state_pedal_size; s++) {
for ( t = 0; t < state_slope_size; t++) {
for ( u = 0; u < action_size; u++) {
fscanf (fp, "%.4f", &qTable[r][s][t][u]);
}}}}
}
int o,k,l,m,n=0;
for ( o = 0; o < state_speed_size; o++) {
for ( k = 0; k < state_pedal_size; k++) {
for ( l = 0; l < state_slope_size; l++) {
printf("\n");
n++;
printf("\n");
for ( m = 0; m < action_size; m++) {
printf("\n%.3f",qTable[o][k][l][m]);
}}}}
fclose(fp);
system("pause");
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.130.175.96
推
07/13 17:38, , 1F
07/13 17:38, 1F
→
07/13 17:46, , 2F
07/13 17:46, 2F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章