不才的程式很肉腳
之前在寫一個讀取檔案的小程式
===============================
#include<iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream in("abc.txt");
double i;
if(!in)
{
cout << "no such file";
return 0;
}
while (in>>i)
{
cout << i<<endl;
}
return 0;
}
===============================
txt內容為1.2 2.5 4.6 三個數值
xcode 3.2.1
compilers:gcc 4.0.1 gcc 4.2.1
===============================
想要把它讀入&顯示在螢幕上
xcode似乎有讀到檔案
但是沒有輸出內容
但這個小程式在windows上運作良好(gun gcc)
不才想請問前輩
是否有解
謝謝
PS. 由於需要將讀入的數值做其他的運算
所以需要宣告成double型態





























































































