    #include<iostream>
    #include<fstream>
    #include<string>
    
    using namespace std;
    
    
    class employ
    {
    private:
    int			m_id;
    string		m_name;
    float		m_salary; //m_ for memeber
    public:
    employ()
    {
    	m_id	 = 0;
    	m_name	 = "";
    	m_salary = 0.0f;
    }
    ~employ()
    {} 
    
    void Input_Data()
    {
    	cout << "Enter id: ";
    	cin	 >> m_id;
    	cout << "Enter name: ";
    	cin  >> m_name;
    	cout << "Enter salary: ";
    	cin  >> m_salary;
    }
    
    
    friend ostream& operator<<(ostream& show, const employ& emp)
    {
    		show << "Id     =  " << emp.m_id	 << endl;
    		show << "Name   =  " << emp.m_name	 << endl;
    		show << "Salary =  " << emp.m_salary << endl;
    		return(show);
    	}
    
    } ;
    
    
    template<class TYPE>
    class Node
    {
    public:
    	TYPE			m_Value;
    	Node<TYPE>*		m_NextElement;	
     
    };
     
    template<class TYPE>
    class List
    {
    public:
    	Node<TYPE>*		m_Start;
    	Node<TYPE>*		m_Current;
    	int				m_Size;
     
    	List():m_Start(NULL),m_Current(NULL),m_Size(0)
    	{
    		m_Start		= new Node<TYPE>;
    	}
     
    	void Add(TYPE data)
    	{
    		if(Size() == 0) 
    		{
    			m_Start->m_Value = data;
    			m_Start->m_NextElement   = new Node<TYPE>;
    			m_Current				 = m_Start->m_NextElement;
    		}
    		else
    		{
    			m_Current->m_Value		 = data;
    			m_Current->m_NextElement =  new Node<TYPE>;
    			m_Current				 =  m_Current->m_NextElement;		
    		}
    		m_Size++;
     
    	}
    	int Size()
    	{
    		return(m_Size);
    	}
    	void Print()
    	{
    		Node<TYPE>* temp = m_Start;
    		while(temp != m_Current)
    		{
    			cout << temp->m_Value << endl;
    			temp = temp->m_NextElement;
    		}
    	}
    
    	void Save_To_File(string file_name)
    	{
    		ofstream Out(file_name.c_str(),ios_base::binary);
    		Out.write( (char*)this,(sizeof(Node<employ>) * Size()));
    		Out.close();
    	}
    	void Load_From_File(string file_name, int size)
    	{
    		if(size != 0)
    		{
    		m_Size = size;
    		ifstream In(file_name.c_str(),ios_base::binary);
    		In.read( (char*)this,sizeof(Node<employ>)*Size() );
    		In.close();
    		}
    	}
    	~List()
    	{
    		Node<TYPE>* temp = m_Start;
    		Node<TYPE>* del;
    		while(temp != m_Current)
    		{
    			del = temp;
    			temp = temp->m_NextElement;
    			delete del;
    		}
    		m_Start = m_Current = 0;
    	}
    };
    
    
    
    int main()
    { 
    	List<employ> list1;
    	employ tmp;
    	char anwser = '?';
    	do
    	{
    		tmp.Input_Data();
    		list1.Add(tmp);
    		cout << "Would You like to continue (Y/N) :";
    		cin  >> anwser;
    	}
    	while(anwser == 'y' || anwser == 'Y');//all other key exit the loop
    	//List<employ> list2;
    	list1.Print();
    
    return 0;
    }

