I am having a problem reading a set of data from notepad that looks like this:
300 450 500 210
510 600 750 400
627 100 420 430
530 621 730 530
200 050 058 200
100 082 920 290
this is what i have so far:
#include <iostream>
#include <iomanip>
#include <fstream>
using namespace std;
int main()
{
float shift[1000];
ifstream infile;
infile.open("factory.dat");
int k = 0;
if (!infile)
{
cout << "unable to open file";
exit(1); // terminate with error
}
while (infile >> shift[k])
k++;
for (int i = 0; i < k; i++)
cout << shift[i];
cout << endl;
infile.close();
return 0;
}