I have a problem with search function by name ,could anyone help me?
This my code so far!!
Thanks in advance.

#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdlib>
#include <string>

using namespace std;


class phonebook {

    public :     

  phonebook() : MobilNumber(0), lastName(""), firstName(""), pcode(0),Email(""),city(""),Street("") { }
  void setMobilNumber( int num) { MobilNumber = num; }
  void setLastName (string lname) { lastName = lname; }
  void setFirstName(string fname) { firstName = fname; }
  void setEmail( string mail) { Email = mail; }
  void setcity (string cty) { city = cty; }
  void setstreet(string strt) { Street = strt; }
  void setpcode( int code) {  pcode = code; }
  int getMobilNumber() const { return MobilNumber; }
  string getLastName() const { return lastName; }
  string getFirstName() const { return firstName; }
  int getpcode() const { return pcode; }
  string getEmail() const { return Email; }
  string getcity() const { return city; }
  string getstreet() const { return Street; }
  
private:

        string firstName;
        string lastName;
        int MobilNumber;
        string Email;
        string city;
        string Street;
	    int pcode;
};


        	int enterChoice();
            void textFile( fstream& );
            void updateRecord( fstream& );
            void newRecord( fstream& );
            void deleteRecord( fstream& );
            void outputLine( ostream&, const phonebook& );
            int getmobil( const char * const );
            char getname( const char * const );
            void searchbyname(fstream&);
            void searchbyphone(fstream&);
            enum Choices { TEXTFILE = 1, UPDATE, NEW, DELETE,SEARCH_BY_NAME,SEARCH_BY_PHONE,END};
	
/*----------------------------------Main function------------------------------*/
int main()
{
      // note: fstream object, both input and output
  fstream inOutUser( "credit.dat", ios::in | ios::out );

   if ( !inOutUser )
   {  cerr << "File could not be opened." << endl;
      
   }
   
   int choice;
          
   while ( ( choice = enterChoice() )!=END  )
   {
      switch ( choice )
      {
         case TEXTFILE:                      // create a text file to print
            textFile( inOutUser );
            break;
         case UPDATE:                        // update a record
            updateRecord( inOutUser );     
            break;
         case NEW:                           // add a record
            newRecord( inOutUser );        
            break;
         case DELETE:                        // remove a record
            deleteRecord( inOutUser );
            break;
		 case SEARCH_BY_NAME:
			 searchbyname(inOutUser);
			 break;
		 case SEARCH_BY_PHONE:
			 searchbyphone(inOutUser);
             break;
		 default:
            cerr << "Incorrect choice\n";
             break;
      }
      inOutUser.clear();  // resets end-of-file indicator
   }
   
   return 0;
}
/*----------------------------User's choice------------------------------*/
// Prompt for and input menu choice
int  enterChoice()
{
   cout << "\nEnter your choice" << endl
        << "1 - store a formatted text file of \n"
        << "    called \"print.txt\" for printing\n"
        << "2 - update a record\n"
        << "3 - add a new record\n"
        << "4 - delete a record\n"
		<< "5 - search by name\n"
        << "6 - search by phone\n"
        << "7 - end program\n? ";

   int menuChoice;
   cin >> menuChoice;
   return menuChoice;
}
/*-------------------------Creation of textfile------------------------------*/
// Create formatted text file for printing
void textFile( fstream &readFromFile )
{
   ofstream outPrintFile( "c:\\print.txt", ios::out );

   if ( !outPrintFile )
   {  cerr << "Print file could not be opened." << endl;
      exit(1);
   }
        
   outPrintFile << setiosflags( ios::left ) << setw( 10 ) 
       << "First name :" << setw( 16 ) << "Last Name :" << setw( 11 )
       << "Email address :"<<setw(10)
	   << "City name :" <<setw(10)<<"Street name :"<<setw(10)
	   << "Postal code :"<<resetiosflags( ios::left ) 
       << setw( 10 ) << "Mobil number" << endl;
   readFromFile.seekg( 0 );      // start at the beginning
   phonebook person;
   readFromFile.read( reinterpret_cast<char *>( &person ),
                      sizeof( phonebook) );

   while ( !readFromFile.eof() )
   {
      if ( person.getMobilNumber() != 0 )          // skip empty records
         outputLine( outPrintFile, person);

      readFromFile.read( reinterpret_cast<char *>( &person ), 
                         sizeof(phonebook ) );
   }
  
}
/*----------------------UpdateRecord function------------------------------*/

// Update mobil's number
void updateRecord( fstream &updateFile )
{
   int mobil = getmobil( "Enter Mobil number to update" );

   updateFile.seekg( ( mobil - 1 ) * sizeof( phonebook) );

  phonebook person;
   updateFile.read( reinterpret_cast<char *>( &person ), 
                    sizeof( phonebook ) );

   if ( person.getMobilNumber() != 0 )
   {
      outputLine( cout, person );
      
      updateFile.seekp( ( mobil - 1 ) * sizeof( phonebook ) );
      updateFile.write(
	  reinterpret_cast<const char *>( &person ),
	  sizeof( phonebook) );
   }
   else
      cerr << "Mobil #" << mobil 
           << " has no information." << endl; 
}
/*-------------------------New Users entryfile function---------------------*/

// Create and insert new record
void newRecord( fstream &insertInFile )
{
   int mobil= getmobil( "Enter new mobil number" );

   insertInFile.seekg( (mobil - 1 ) * sizeof( phonebook) );

 phonebook person;
   insertInFile.read( reinterpret_cast<char *>( &person ), 
                      sizeof(phonebook ) );
      string firstName;
      string lastName;
      string Email;
      string city;
      string Street;
	    int pcode;
   if ( person.getMobilNumber() == 0 )    // make sure record is empty
   {
      cout << "Enter lastname, firstname,mobilnumber,postal code,Email address,city,street\n ";
      cin >> lastName  >> firstName 
          >> pcode  >> Email
		  >> city >>  Street;
        person.setLastName( lastName );
        person.setFirstName( firstName );
        person.setpcode( pcode );
        person.setMobilNumber( mobil );
		person.setcity( city );
        person.setstreet( Street );
		person.setEmail( Email);
       
      insertInFile.seekp( ( mobil - 1 ) * 
                          sizeof( phonebook ) );
      insertInFile.write( 
         reinterpret_cast<const char *>( &person ), 
         sizeof(phonebook ) );
   }
   else
      cerr << "mobilnumber #" << mobil
           << " already contains information." << endl;
}
 
 
/*-----------------------Deletion of User's details----------------------*/

// Delete an existing record
void deleteRecord( fstream &deleteFromFile )
{
   int mobil = getmobil( "Enter mobil number to delete" );

   deleteFromFile.seekg( (mobil - 1) * sizeof( phonebook ) );

  phonebook person;
   deleteFromFile.read( reinterpret_cast<char *>( &person ), 
                        sizeof( phonebook ) );

   if ( person.getMobilNumber() != 0 )       // make sure record exists
   {
   phonebook * MobilOwner = new phonebook();

      deleteFromFile.seekp( ( mobil - 1) * 
                            sizeof( phonebook ) );
      deleteFromFile.write( 
         reinterpret_cast<const char *>( &MobilOwner ), 
         sizeof( phonebook ) );
     
      cout << "Mobil #" << mobil << " deleted." << endl;
   }
   else
      cerr << "Mobil #" << mobil << " is empty." << endl;
}
/*-------------------User's Output function--------------------------*/

// Output a line of User's information
void outputLine( ostream &output, const phonebook &c )
{
   output << setiosflags( ios::left ) << setw( 10 ) 
          << c.getMobilNumber() << setw( 16 ) << c.getLastName() 
          << setw( 11 ) << c.getFirstName() << setw( 10 ) 
          << c.getEmail() <<setw( 10 ) << c.getcity() <<setw( 10 )
		  << c.getstreet() <<setw( 10 ) << c.getpcode() <<setw( 10 )
          << setprecision( 2 ) << resetiosflags( ios::left )
          << setiosflags( ios::fixed | ios::showpoint )  ;        
   
}
/*---------------------Search User by the firstname---------------------*/
 void searchbyname(fstream &search_nameFile)
{

string  name = getname( "Enter the Last name of the user " );

   //int name = reinterpret_cast<int>(pname);
   search_nameFile.seekg( ( name - 1 ) * sizeof( phonebook) );

  phonebook person;
  search_nameFile.read( reinterpret_cast<char *>( &person ), 
                    sizeof( phonebook ) );

   if ( person.getFirstName() != " " )
   {
      outputLine( cout, person );
     
      search_nameFile.seekp( (name - 1 ) * sizeof( phonebook ) );
      search_nameFile.write(
	  reinterpret_cast<const char *>( &person ),
	  sizeof( phonebook) );
   }
   else
      cerr << "The name :" <<"["<< name 
           <<"]"<< " does not exist." << endl; 
}
/*------------------Search by the phone------------------------------------*/
void  searchbyphone(fstream &search_phoneFile)
{
   int mobil = getmobil( "Enter Mobil number you want to search by" );

   search_phoneFile.seekg( ( mobil - 1 ) * sizeof( phonebook) );

  phonebook person;
  search_phoneFile.read( reinterpret_cast<char *>( &person ), 
                    sizeof( phonebook ) );

   if ( person.getMobilNumber() != 0 )
   {
      outputLine( cout, person );
      
      search_phoneFile.seekp( ( mobil - 1 ) * sizeof( phonebook ) );
     search_phoneFile.write(
	  reinterpret_cast<const char *>( &person ),
	  sizeof( phonebook) );
   }
   else
      cerr << "Mobil #" <<"["<< mobil
           <<"]"<< " does not exist." << endl; 
} 
/*-----------------get mobil number from the keyboard--------------------*/
int getmobil( const char * const prompt )
{
   int mobil;

   do {
      cout << prompt << " (1 - 100): ";
      cin >> mobil;
   } while ( mobil < 1 || mobil > 100 );

   return mobil;
} // end getmobil
/*-------------------------get name from the keyboard--------------------*/
string getname(string name)

{

do
	{
	   cin >> name;
	}while (name!="");
	return name;
}
/*&-------------------------------------END------------------------------------*/

>> search_nameFile.seekg( ( name - 1 ) * sizeof( phonebook) );

variable name is a std::string -- why are you attempting to treat it as an integer? I would think that function searchbyname() should seek to the beginning of the file then enter a loop to sequentially read each record until eof or the desired name is found. Your version of that function does not do that at all.

>> search_nameFile.seekg( ( name - 1 ) * sizeof( phonebook) );

variable name is a std::string -- why are you attempting to treat it as an integer? I would think that function searchbyname() should seek to the beginning of the file then enter a loop to sequentially read each record until eof or the desired name is found. Your version of that function does not do that at all.

so how about this i've changed the search method by refering to one the threads hear ,syntax is ok but not doing what i want and im even receing some warnigs can anybody try to run it figure out for me wht could the problem,thanx!!

This is it

#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdlib>
#include <string>
#include <vector>

using namespace std;


class phonebook {

    public :     

  phonebook() : MobilNumber(0), lastName(""), firstName(""), pcode(0),Email(""),city(""),Street("") { }
  void setMobilNumber( int num) { MobilNumber = num; }
  void setLastName (string lname) { lastName = lname; }
  void setFirstName(string fname) { firstName = fname; }
  void setEmail( string mail) { Email = mail; }
  void setcity (string cty) { city = cty; }
  void setstreet(string strt) { Street = strt; }
  void setpcode( int code) {  pcode = code; }
  int getMobilNumber() const { return MobilNumber; }
  string getLastName() const { return lastName; }
  string getFirstName() const { return firstName; }
  int getpcode() const { return pcode; }
  string getEmail() const { return Email; }
  string getcity() const { return city; }
  string getstreet() const { return Street; }
  
private:

        string firstName;
        string lastName;
        int MobilNumber;
        string Email;
        string city;
        string Street;
	    int pcode;
};


        	int enterChoice();
            void textFile( fstream& );
            void updateRecord( fstream& );
            void newRecord( fstream& );
            void deleteRecord( fstream& );
            void outputLine( ostream&, const phonebook& );
            int getmobil( const char * const );
            char getname( const char * const );
            void searchbyname(fstream&);
            void searchbyphone(fstream&);
            enum Choices { TEXTFILE = 1, UPDATE, NEW, DELETE,SEARCH_BY_NAME,SEARCH_BY_PHONE,END};
	
/*-----------------------------------Main function------------------------------*/
int main()
{
      // note: fstream object, both input and output
  fstream inOutUser( "credit.dat", ios::in | ios::out );

   if ( !inOutUser )
   {  cerr << "File could not be opened." << endl;
      
   }
   
   int choice;
          
   while ( ( choice = enterChoice() )!=END  )
   {
      switch ( choice )
      {
         case TEXTFILE:                      // create a text file to print
            textFile( inOutUser );
            break;
         case UPDATE:                        // update a record
            updateRecord( inOutUser );     
            break;
         case NEW:                           // add a record
            newRecord( inOutUser );        
            break;
         case DELETE:                        // remove a record
            deleteRecord( inOutUser );
            break;
		 case SEARCH_BY_NAME:
			 searchbyname(inOutUser);
			 break;
		 case SEARCH_BY_PHONE:
			 searchbyphone(inOutUser);
             break;
		 default:
            cerr << "Incorrect choice\n";
             break;
      }
      inOutUser.clear();  // resets end-of-file indicator
   }
   
   return 0;
}
/*-----------------------------------User's choice------------------------------*/
// Prompt for and input menu choice
int  enterChoice()
{
   cout << "\nEnter your choice" << endl
        << "1 - store a formatted text file of \n"
        << "    called \"print.txt\" for printing\n"
        << "2 - update a record\n"
        << "3 - add a new record\n"
        << "4 - delete a record\n"
		<< "5 - search by name\n"
        << "6 - search by phone\n"
        << "7 - end program\n? ";

   int menuChoice;
   cin >> menuChoice;
   return menuChoice;
}
/*-----------------------------------Creation of textfile------------------------------*/
// Create formatted text file for printing
void textFile( fstream &readFromFile )
{
   ofstream outPrintFile( "c:\\print.txt", ios::out );

   if ( !outPrintFile )
   {  cerr << "Print file could not be opened." << endl;
      exit(1);
   }
        
   outPrintFile << setiosflags( ios::left ) << setw( 10 ) 
       << "First name :" << setw( 16 ) << "Last Name :" << setw( 11 )
       << "Email address :"<<setw(10)
	   << "City name :" <<setw(10)<<"Street name :"<<setw(10)
	   << "Postal code :"<<resetiosflags( ios::left ) 
       << setw( 10 ) << "Mobil number" << endl;
   readFromFile.seekg( 0 );      // start at the beginning
   phonebook person;
   readFromFile.read( reinterpret_cast<char *>( &person ),
                      sizeof( phonebook) );

   while ( !readFromFile.eof() )
   {
      if ( person.getMobilNumber() != 0 )          // skip empty records
         outputLine( outPrintFile, person);

      readFromFile.read( reinterpret_cast<char *>( &person ), 
                         sizeof(phonebook ) );
   }
  
}
/*-----------------------------------UpdateRecord function------------------------------*/

// Update mobil's number
void updateRecord( fstream &updateFile )
{
   int mobil = getmobil( "Enter Mobil number to update" );

   updateFile.seekg( ( mobil - 1 ) * sizeof( phonebook) );

  phonebook person;
   updateFile.read( reinterpret_cast<char *>( &person ), 
                    sizeof( phonebook ) );

   if ( person.getMobilNumber() != 0 )
   {
      outputLine( cout, person );
      
      updateFile.seekp( ( mobil - 1 ) * sizeof( phonebook ) );
      updateFile.write(
	  reinterpret_cast<const char *>( &person ),
	  sizeof( phonebook) );
   }
   else
      cerr << "Mobil #" << mobil 
           << " has no information." << endl; 
}
/*-----------------------------------New Users entryfile function------------------------------*/

// Create and insert new record
void newRecord( fstream &insertInFile )
{
   int mobil= getmobil( "Enter new mobil number" );

   insertInFile.seekg( (mobil - 1 ) * sizeof( phonebook) );

 phonebook person;
   insertInFile.read( reinterpret_cast<char *>( &person ), 
                      sizeof(phonebook ) );
      string firstName;
      string lastName;
      string Email;
      string city;
      string Street;
	    int pcode;
   if ( person.getMobilNumber() == 0 )    // make sure record is empty
   {
      cout << "Enter lastname, firstname,mobilnumber,postal code,Email address,city,street\n ";
      cin >> lastName  >> firstName 
          >> pcode  >> Email
		  >> city >>  Street;
        person.setLastName( lastName );
        person.setFirstName( firstName );
        person.setpcode( pcode );
        person.setMobilNumber( mobil );
		person.setcity( city );
        person.setstreet( Street );
		person.setEmail( Email);
       
      insertInFile.seekp( ( mobil - 1 ) * 
                          sizeof( phonebook ) );
      insertInFile.write( 
         reinterpret_cast<const char *>( &person ), 
         sizeof(phonebook ) );
   }
   else
      cerr << "mobilnumber #" << mobil
           << " already contains information." << endl;
}
 
 
/*-----------------------------------Deletion of User's details------------------------------*/

// Delete an existing record
void deleteRecord( fstream &deleteFromFile )
{
   int mobil = getmobil( "Enter mobil number to delete" );

   deleteFromFile.seekg( (mobil - 1) * sizeof( phonebook ) );

  phonebook person;
   deleteFromFile.read( reinterpret_cast<char *>( &person ), 
                        sizeof( phonebook ) );

   if ( person.getMobilNumber() != 0 )       // make sure record exists
   {
   phonebook * MobilOwner = new phonebook();

      deleteFromFile.seekp( ( mobil - 1) * 
                            sizeof( phonebook ) );
      deleteFromFile.write( 
         reinterpret_cast<const char *>( &MobilOwner ), 
         sizeof( phonebook ) );
     
      cout << "Mobil #" << mobil << " deleted." << endl;
   }
   else
      cerr << "Mobil #" << mobil << " is empty." << endl;
}
/*-----------------------------------User's Output function-----------------------------------------*/

// Output a line of User's information
void outputLine( ostream &output, const phonebook &c )
{
   output << setiosflags( ios::left ) << setw( 10 ) 
          << c.getMobilNumber() << setw( 16 ) << c.getLastName() 
          << setw( 11 ) << c.getFirstName() << setw( 10 ) 
          << c.getEmail() <<setw( 10 ) << c.getcity() <<setw( 10 )
		  << c.getstreet() <<setw( 10 ) << c.getpcode() <<setw( 10 )
          << setprecision( 2 ) << resetiosflags( ios::left )
          << setiosflags( ios::fixed | ios::showpoint )  ;        
   
}

/*-----------------------------------Search User by the name-----------------------------------------*/
void searchbyname(fstream &search_nameFile)

{
     cout<<"An empty string or EOF will stop the program"<<endl;


            for (;;)
	{
            string name;
            cout<<"Enter the name";
              if ( !getline ( cin, name ) || name.empty() )
              break;

             if ( !search_nameFile)
		   
			 {
                cerr<<"Error opening file"<<endl;
     		 }

              vector<string> lines;
              string line;

              while ( getline ( search_nameFile, line ) )
	   
	   {
          if ( line.find ( name ) )
          lines.push_back ( line );
	   }

          if ( lines.empty() )
          cout<<"No records found"<<endl;
          else if ( lines.size() == 1 )
          cout<<"One record found"<<endl;
          else
          cout<<"Multiple records found"<<endl;

          for ( vector<string>::size_type i = 0; i < lines.size(); i++ )
          cout<< lines[i] <<endl;
	}



}

/*-----------------------------------Search by the phone-----------------------------------------*/
void  searchbyphone(fstream &search_phoneFile)
{
   int mobil = getmobil( "Enter Mobil number you want to search by" );

   search_phoneFile.seekg( ( mobil - 1 ) * sizeof( phonebook) );

  phonebook person;
  search_phoneFile.read( reinterpret_cast<char *>( &person ), 
                    sizeof( phonebook ) );

   if ( person.getMobilNumber() != 0 )
   {
      outputLine( cout, person );
      
      search_phoneFile.seekp( ( mobil - 1 ) * sizeof( phonebook ) );
     search_phoneFile.write(
	  reinterpret_cast<const char *>( &person ),
	  sizeof( phonebook) );
   }
   else
      cerr << "Mobil #" <<"["<< mobil
           <<"]"<< " does not exist." << endl; 
} 
/*-----------------------------------get mobil number from the keyboard-----------------------------------------*/
int getmobil( const char * const prompt )
{
   int mobil;

   do {
      cout << prompt << " (1 - 100): ";
      cin >> mobil;
   } while ( mobil < 1 || mobil > 100 );

   return mobil;
} // end getmobil

To answer your specific question, as a start, it would be helpful to indicate what the warnings are and what code you think the warning refers to.

In a more general sense, I think you need to think about the relationship between what you refer to as phonebook, record, and person within your code. Using comments can help you dramatically in this regard.

To answer your specific question, as a start, it would be helpful to indicate what the warnings are and what code you think the warning refers to.

In a more general sense, I think you need to think about the relationship between what you refer to as phonebook, record, and person within your code. Using comments can help you dramatically in this regard.

Ok here r warnings that received!!

Deleting intermediate files and output files for project 'phonebook - Win32 Debug'.
--------------------Configuration: phonebook - Win32 Debug--------------------
Compiling...
phonebook.cpp
e:\school\c++\c++\phonebook.cpp(305) : warning C4786: 'std::reverse_iterator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const *,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std
::char_traits<char>,std::allocator<char> > const &,std::basic_string<char,std::char_traits<char>,std::allocator<char> > const *,int>' : identifier was truncated to '255' characters in the debug information
e:\school\c++\c++\phonebook.cpp(305) : warning C4786: 'std::reverse_iterator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > *,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char
_traits<char>,std::allocator<char> > &,std::basic_string<char,std::char_traits<char>,std::allocator<char> > *,int>' : identifier was truncated to '255' characters in the debug information
e:\program files\microsoft visual studio\vc98\include\vector(39) : warning C4786: 'std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >
>::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >' : identifier was truncated to '255' characters in the debug information
e:\program files\microsoft visual studio\vc98\include\vector(60) : warning C4786: 'std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >
>::~vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >' : identifier was truncated to '255' characters in the debug information
Linking...

phonebook.exe - 0 error(s), 4 warning(s)

There are few warnings that you should feel comfortable about ignoring, but warning C4786: is the exception to the rule. This particular warning is very common when I use VC6++ and STL containers like vectors. You can use a pragma statement to prevent them from showing up, use a different compiler, or ignore them. Since I forget the pragma statement syntax and don't want to get another compiler yet, I usually just ignore them.

The bad news is that these warnings aren't the source of your problems. I think working on the other suggestion in my previous post will go a long way to fixing what ails your program.

put this as the very first line in stadafx.h but after include safeguards

#pragma warning(disable: 4786)

Note: NO semicolon! That warning only occurs when your program is compiled in debug mode and can safely be ignored. If you don't disable it, it will muddy up compiler complaints quite badly.

put this as the very first line in stadafx.h but after include safeguards

#pragma warning(disable: 4786)

Note: NO semicolon! That warning only occurs when your program is compiled in debug mode and can safely be ignored. If you don't disable it, it will muddy up compiler complaints quite badly.

wow its amazing ,it did reduce them to 2 warnings.:)
Thnx ppl but still this program doesnt do eactly what i want to..
Have u ever!! i think i did all could but now i've got no clue how to approach this or what change it to make it work....

To me at least, the member variables of the phonebook class represent the attributes of a person/customer or phonebook record, but they don't represent a phonebook. A phone book to me is a collection of phonebook records or people/customers. This means I think your C++ syntax is (mostly) correct (you mentioned two remaining warnings after adding the pragma statement, so there may still be some concerns with the syntax, too), but you have an underlying logic problem. I would redesign the program by renaming your phonebook class customer or person or record, and then determine which container class---array, list, map, set, vector, (?file?)---would be the most appropriate for a collection of customers/people/records. Then you could either keep the independent functions as listed and pass them the appropriate parameters or roll them into another class called phonebook that has a container of the customers/people/records as a member variable and the current independent functions as member variables.

thank you guys!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.