// L-5 MCS 360 Mon 30 Aug 2010 : use_phonebook.cpp

/* This program uses a command line argument to switch between
   normal reader mode (without argument) and administrator mode,
   using any argument. */

#include "phonebook.h"
#include<iostream>

using namespace std;

int main(int argc, char* argv[])
{
   PhoneBook b;
   int n = b.length();

   cout << "number of entries : " << n << endl;
   if(argc == 1)
      for(int k=0; k<n; k++)
         cout << "  entry " << k << " : " 
              << b[k] << endl;
   else
   {
      string new_entry;

      cout << "give new entry : ";
      getline(cin,new_entry);

      b.add(new_entry);
   }

   return 0;
}

