I have a file which contain these data :
6
1231234213 12
2312354234 23
3254132515 43
I want to store all these data into an array :
int main() {
ifstream infile("data.txt");
ofstream outfile("final.txt");
int sn = 0;
infile >> sn;
int* arr;
arr = new int[sn];
for (int i = 0; i < sn; i++)
{
infile >> arr[i];
}
for (int i = 0; i < sn; i++)
{
cout << arr[i] << endl;
}
}
but I'm getting this instead of those data :
1231234213
12
2147483647
-842150451
-842150451
-842150451
int64_tinstead of int if your data requires 64 bit integers.