#include "userlist.h"

// initialize data structure
UserList::UserList ()
{
   Counter = 0;
}

// add new user to data structure
void UserList::Add ( string &aName, string &aSSN )
{
   if (Counter < 10)
   {
      Data[Counter].Name = aName;
      Data[Counter].SSN = aSSN;
      Counter++;
   }
}

// remove user from data structure
void UserList::Delete ( string &aName )
{
	// find user by sequential search
	unsigned int i=0;
	while ((i<Counter) && (Data[i].Name != aName))
		i++;

	// remove user
	if (i<Counter)
	{
		while (i<(Counter-1))
		{
			Data[i] = Data[i+1];
			i++;
		}
		Counter--;
	}
}
