如何从我调用数据的文件中读取值 x
我把文件放在程序文件中,但一直给我
文件未找到..
#include <iostream>
#include <cstdlib>
#include <fstream>
#include <string>
using namespace std;
double const NUMB=10;
int main ()
{
double x;
ifstream infile;
infile.open("data");
if (!infile.is_open()){
cout<<"NOT OPEN"<<endl;
system ("PAUSE");
exit (1);
}
infile >>x;
while (infile>0){
cout<<x<<endl;
infile>>x;
}
infile.close();
return 0;
}