insert text files into object of class

So I want to insert a text file into an object of a class called SortedList.
the text file contains floating numbers:

5.5
6.2
7.1
8.0
9.0
10.0
1.0
2.0
3.3
4.4



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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
  #include <iostream>
#include <fstream>
#include <string>
#define MAX_ITEMS 10
typedef float ItemType;
using namespace std;

class SortedList
{
private:
	int length;
	ItemType values[MAX_ITEMS];                    // Static Array
	int currentPos;
public:
	SortedList()                                  // default constructor: lenght=0, currentPos=-1
	{
		length = 0;
		currentPos = -1;
	}
	void MakeEmpty()                             // let length=0
	{
		length = 0;
	}
	void InsertItem(ItemType x)                  // insert x into the list   
	{
		for (int i = 0; i < length; i++)
		{
			if (values[i] <= x && x < values[i + 1])
			{
				currentPos = i + 1;
				break;
			}
		}
	}
	//void DeleteItem(ItemType x);                   // delete x from the list
	bool IsFull();                                  // test if the list is full
	int Lengthls()                                   // return length
	{
		return length;
	}
	//void RetrieveItem(ItemType &x, bool &found);      // retrieve x from the list, the boolean result is stored in found
	void ResetList()                                 // currentPos=-1
	{
		currentPos = -1;
	}
	//void GetNextItem(ItemType &x);                // get the next element from the list with respect to the currentPos

};

int main()
{
	SortedList Instance1;

	string line;
	ifstream myfile ("float.txt");
	if (myfile.is_open())
	{
		while (getline(myfile, line))
		{
			Instance1.InsertItem()      // i got stuck here.. what to do? 
		}
		myfile.close();
	}
	else cout << "Unable to open file";

	system("Pause");
	return 0;

}
Topic archived. No new replies allowed.