I have generated a data.txt file that contains a huge number of integers into two columns.
How can I save these integers into arrays?
You can find the data.txt here if that helps. Sample:
600000
523887 283708
231749 419866
293707 273512
296065 215334
233447 207124
264381 460210
374915 262848
449017 329022
374111 151212
2933 496970
I have tried this but for some reason its not working..
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
fstream input("data-for-union-find.txt");
int i=0;
float a;
int size=0;
size=i/2;
while (input >> a)
{i++;
}
int *x=new int[size];
int *y=new int[size+1];
for(int j=0;j<(size+1);j++)
{
input>>x[j];
input>>y[j];
cout<<x[j]<<" "<<y[j]<<" "<<j<<endl;
return 0;
}
}