Sorry I forgot ( I remember I used them though) Anyways.
The problem is that when I make an insertion of an element, I don't want to insert a repeated element, so if I inserted (Age = 20) and then If I insert (Age = 20) my list should have only one person who Age is 20, i don't want two ages of 20 in my list. Insertion without repeating elements.
template <typename ListElement>
void List <ListElement>::Insert()
{
NodePtr Ptr;
Ptr = new Node;
bool repeated = true;
if (Ptr == NULL)
{
cout << "Error: Insuficient Storage " << endl;
exit(1);
}
cout << " Enter The Social Security Number of New Student: ";
cin >> Ptr->Info.SSN;
cout << "Enter The Age of This Student: ";
cin >> Ptr->Info.Age;
while( Ptr->Next != NULL)
{
if(Ptr->Info.Age == Ptr->Next->Info.Age)
repeated = false;
break; // This break is for not to add the element
Ptr = Ptr->Next;
}
Ptr->Next = Head;
Head = Ptr;
if(repeated = false)
cout << "repetition just ocurred" << endl; // This is just 4 me to verified if the function works
}