I'm doing a bubble sort program, but I don't need help with the algorithm. However, I do need help reading a txt file into an array. The file is a bunch of double values of unknown amount (But less than 1000 items), like:
1.023
1233
532.9
etc...
I plan to pass the file through input redirection. (prgm.exe < data.txt) So, I want the for loop to stop once it reaches the end of the file. My attempt so far, that I know doesn't work:
1 2 3 4 5 6 7
double d[1000];
int size;
for(int i = 0; i < 1000; i++)
{
cin >> d[i];
size++;
}