not reading entire file

Hey Guys, I could really use some help. I have a file that looks like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
4
5             
2          
8           
1             

2             
4             
8                
4            
5           
2             
5             
8
1
7


My problem is that my code will only read the first set and not the second set. Any suggestions?? Here is my code so far:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>

using namespace std;

int main()
{
    int nums = 0; 
	int mymin, mymax, myavg;
	int *array = NULL;
	fstream file;

	ifstream ifs("datasets.txt");
	ifs >> nums;
	array = new int[nums];
	for (int i=0; i < nums; i++)
	{
		ifs >> array[i];
		cout << "Array: " << array[i] << endl;
	}

	
	delete[] array;
	return 0;
}


Any help greatly appreciated!!!
Last edited on
Topic archived. No new replies allowed.