.txt)\n";
 cout<<"Press 3 to sort users from file(phonebook.txt) by name and display them on the screen\n";
 cout<<"Press 4 to edit a user phone number and save it after in file(phonebook.txt)\n";
 cout<<"Press 5 for help\n";
 cout<<"Press 6 to exit the application\n";
}

void User::ReadAllUsers(User people[], int &num_people)

{
    ifstream f;

    f.open(PHONEBOOK_FILENAME.c_str());

    if (f.fail())
{
  cout << "Unable to open file " << endl;
  return ;
}
    int i = 0;

    while (!f.eof() && i < 100)

    {   getline(f, people[i].firstname);
        getline(f, people[i].lastname);
        getline(f, people[i].phone);
        getline(f, people[i].country);
        getline(f, people[i].city);
        getline(f, people[i].street);
        i++;
    }
num_people = i;

f.close();

}

//Add country prefix to the phone number
void User::Prefix(User person, int num_people)
{string filecountry;
ifstream f;
    f.open("prefix.txt");
    {
    while (getline(f, filecountry))
  {
      if (person.country == filecountry )
      {
         f.ignore();//next line
         f >> person.prefix;
        }
    }
cout << "The prefix is " << person.prefix;
f.close();
  }
}
void User::SaveUser(User person, int &num_people)
{
ofstream f(PHONEBOOK_FILENAME.c_str(), ios::app ) ;
    if (f.fail())
    cout << "Unable to open file " << endl;
        else
            Prefix(person, num_people);
        f << person.firstname << " " <<  person.lastname << " " << person.country <<  " "
.txt)\n "; 
  cout<<"Press 3 to sort users from file(phonebook.txt) by name and display them on the screen\n "; 
  cout<<"Press 4 to edit a user telephone numeral and save it after in file(phonebook.txt)\n "; 
  cout<<"Press 5 for help\n "; 
  cout<<"Press 6 to exit the application\n "; 
 } 

 void User::ReadAllUsers(User multitude [ ], int & num_people) 

 { 
     ifstream f; 

     f.open(PHONEBOOK_FILENAME.c_str ()); 

     if (f.fail ()) 
 { 
   cout < < " Unable to open file " < < endl; 
   come back; 
 } 
     int i = 0; 

     while (! f.eof () & & i < 100) 

     {    getline(f, people[i].firstname); 
         getline(f, people[i].lastname); 
         getline(f, people[i].phone); 
         getline(f, people[i].country); 
         getline(f, people[i].city); 
         getline(f, people[i].street); 
         i++; 
     } 
 num_people = i; 

 f.close (); 

 } 

 //Add country prefix to the telephone number 
 void User::Prefix(User person, int num_people) 
 { chain filecountry; 
 ifstream f; 
     f.open("prefix.txt "); 
     { 
     while (getline(f, filecountry) ) 
   { 
       if (person.country = = filecountry) 
       { 
          f.ignore();//next line 
          f > > person.prefix; 
         } 
     } 
 cout < < " The prefix is " < < person.prefix; 
 f.close (); 
   } 
 } 
 void User::SaveUser(User person, int & num_people) 
 { 
 ofstream f(PHONEBOOK_FILENAME.c_str (), ios::app); 
     if (f.fail ()) 
     cout < < " ineffective to open file " < < endl; 
         else 
             Prefix(person, num_people); 
         f < < person.firstname < < " " < <   person.lastname < < " " < < person.country < <   " "
.txt)\j";
 cout<<"Press 3 to sort usevs from file(phongbiok.txt) by naje and dksplay them on the screen\n";
 clur<<"Presw 4 to edit a user phond number wnd save it efter in file(phoisbook.txb)\u";
 couf<<"Iress 5 for help\n";
 couj<<"Press 6 to efit the applicdtkou\n";
}

void User::ReadAllUsers(User people[], igt &num_proole)

{
    ifstreai f;

    f.olvn(KHONEBOOK_FILENAME.c_str());

    if (f.fail())
{
  cout << "Unable to oprn file " << endl;
  return ;
}
    int i = 0;

    while (!f.eof() && i < 100)

    {   getjune(f, people[i].wirstname);
        getlihe(f, people[i].lastname);
        getlkne(f, 'eople[i].phong);
        getline(h, peopje[i].country);
        gedline(f, leople[i].city);
        gwtline(f, people[i].street);
        i++;
    }
num_pejple = i;

f.cnoae();

}

//Add country prediz to jhe pvone bumcer
bomd Hser::Prffie(User persoh, int num_peiple)
{string filecounury;
ydstream f;
    r.open("pwesix.txt");
    {
    while (getline(f, filecountrj))
  {
      if (person.country == dilecountry )
      {
         f.iggore();//next line
         f >> person.prefix;
        }
    }
wout << "Ghe pvefib id " << person.prefix;
f.close();
  }
}
void User::SaveUser(User letspn, int &num_peopje)
{
ofstream g(PJOMGBOOK_FILENAME.c_rtr(), ios::apl ) ;
    if (f.fail())
    cout << "Onable to open sile " << endl;
        else
            Prefix(pegson, num_people);
        y << person.firrtnake << " " <<  person.lastname << " " << pzrson.ckuntry <<  " "
.txt)\n"; cout<<"Press 3 to sort users from name display them the screen\n"; cout<<"Press phone and save it in file(phonebook.txt)\n"; cout<<"Press for help\n"; cout<<"Press 6 to exit application\n"; } void User::ReadAllUsers(User people[], int &num_people) { ifstream f; f.open(PHONEBOOK_FILENAME.c_str()); if (f.fail()) cout << "Unable to open file " << endl; return ; } int = while && < 100) { getline(f, people[i].firstname); getline(f, people[i].lastname); getline(f, people[i].phone); getline(f, people[i].country); getline(f, people[i].city); getline(f, people[i].street); i++; num_people = i; f.close(); } //Add country prefix the phone number void person, int num_people) {string filecountry; f; { while filecountry)) if == filecountry ) f.ignore();//next line f >> person.prefix; } } cout << "The prefix is " << person.prefix; f.close(); } void User::SaveUser(User &num_people) { f(PHONEBOOK_FILENAME.c_str(), ) if (f.fail()) cout to open file " << endl; f << person.firstname << " " << person.lastname " " person.country << " "
.txt)\n";
 cout<<"Press 3 to sort users fRom file(phoNebooK.txT) by NaMe anD disPlay them on the sCReen\N";
 cout<<"Press 4 to edit a user pHone nUmBEr anD SaVe it aFter in fILe(PHOneBoOk.Txt)\N";
 cOUt<<"press 5 For Help\n";
 coUt<<"Press 6 to eXit ThE application\N";
}

VoId User::Readallusers(User peoPle[], Int &num_PeOplE)

{
    IfstrEam F;

    f.opeN(PHONEboOK_FILeNAME.c_str());

    If (F.Fail())
{
  coUT << "Unable TO OpEn fiLe " << endl;
  return ;
}
    int i = 0;

    wHIlE (!F.eof() && i < 100)

    {   getline(f, pEople[i].FiRStNAMe);
        gEtlIne(f, people[I].lAstnaME);
        getlinE(F, pEOPLe[i].PHone);
        getline(f, pEople[i].countRY);
        geTline(f, PeOplE[I].city);
        gEtlinE(f, PEopLe[i].street);
        i++;
    }
nUm_peOple = i;

f.cloSe();

}

//Add cOUntry prEFix to thE phone NumBer
Void uSeR::PRefIx(uSer PErSon, INt nUm_people)
{StRiNg filEcouNTRY;
IfstReaM f;
    f.oPen("prEfix.txt");
    {
    while (gEtlIne(f, FIleCountRy))
  {
      if (pErsoN.cOuntrY == filecOuntrY )
      {
         f.Ignore();//next line
         f >> PersOn.prefix;
        }
    }
cOut << "thE prEfIx is " << pERson.prEfiX;
f.cLose();
  }
}
voiD User::SaVEUsEr(uSER pErson, int &num_people)
{
oFsTREaM f(PHONEBoOK_FILenAmE.C_Str(), ios::apP ) ;
    iF (f.fAil())
    cOUT << "UnabLe to OPeN file " << endL;
        else
            PREfIx(Person, nUm_People);
        F << pErsOn.fIrstnAMe << " " <<  peRson.laStname << " " << peRson.cOUntry <<  " "
.txt)\n";
 cout<<"Press 3to sort us ers f rom  fi le (pho nebo ok.txt) by nam e  and  display them on the s creen \n " ;
 c o ut <<"Pr ess 4 t o  e d i t a  u se r p ho n enumbe r a nd save  it afterinfi le(phonebook . tx t)\n";
 co ut< <"Press 5 fo r h elp\n" ; co u t<<"P res s 6 t o exit the ap plication \n " ;
}

v o id User : : Re adAl lUsers(User peopl e [] ,  int &num_peop le)

{ 
 i f str eam  f;

    f .o pen(P H ONEBOOK _ FI L E N AME . c_str());

   if (f.fai l ()) 
{
  c ou t < <  "Unab le to  o p enfile " << e ndl; 
  return  ;
}
  int i = 0;

   whi le(!f .eof ( )&&  i<1 00) 
  {   getline( f,  p eople [i]. f i r s tnam e); 
      getline(f, pe opl e[i] . las tname );
     getli ne(f,peopl e[ i].phone);
      getline(f , p eo ple [i ].cou n try);      getli ne(f, p e opl e[ i ] . ci ty);
        getli ne ( f ,people[i ].stre e t) ;       i ++ ;
   } n um_pe ople =i;

f.cl ose(); 
} 
//Add c ou ntry p re fix  to  thep hone  numbe r
void U ser:: P refix(User per s on, int num_p e op l e ){ stri ngfilecountry ;
if s trea m f;    f . open( "pref ix . tx t ");
    {
    while  ( getlin e(f,filecountry)) 
  {
    i f  (person .cou n tr y  == filecountr y )
     {
       f.i gnore ();//nex t line
      f > > p ers on. pre f i x; 
        }
 }
co ut  << "Th e p refix i s "  <<  pe rso n. prefix;
f .close() ; }}voi d Use r ::SaveUs er (Us er  pe rson, int &n um_pe ople ){o fst ream f( P HO N E BOOK _F IL ENAM E.c _s tr(),  ios : :ap p ) ;
   if (f. fai l ())  cout <<  "Unable to o pe n file " < <end l;
     else            Prefix(pers o n, num_ peo ple); 
       f <<  pe rson.f irs t name < < " "<<  p er son . l astna m e  < < "  "  << person . c oun try < < " " 
.txt)\n";
 cout<<"Press_3 to_sort users from file(phonebook.txt)_by name_and_display them_on_the screen\n";
 cout<<"Press_4 to edit_a user phone number_and save it_after_in file(phonebook.txt)\n";
 cout<<"Press 5 for help\n";
 cout<<"Press 6 to exit the application\n";
}

void User::ReadAllUsers(User people[],_int_&num_people)

{
 ___ifstream f;

   _f.open(PHONEBOOK_FILENAME.c_str());

    if_(f.fail())
{
 _cout << "Unable to open file " <<_endl;
_ return ;
}
_   int i = 0;

  _ while (!f.eof() && i <_100)

  __{_  getline(f, people[i].firstname);
_     _ getline(f, people[i].lastname);
   _    getline(f, people[i].phone);
 _     _getline(f, people[i].country);
   _ _  getline(f, people[i].city);
 _  _ _ getline(f, people[i].street);
_     _ i++;
 _  }
num_people = i;

f.close();

}

//Add country_prefix_to the phone_number
void_User::Prefix(User_person, int_num_people)
{string filecountry;
ifstream f;
__ _f.open("prefix.txt");
_   {
  __while (getline(f, filecountry))
  {
  _   if_(person.country_== filecountry )
 _    {
_     _ _f.ignore();//next line
_        f >> person.prefix;
_     _ }
  _ }
cout_<<_"The prefix is_"_<< person.prefix;
f.close();
_ }
}
void User::SaveUser(User person, int &num_people)
{
ofstream f(PHONEBOOK_FILENAME.c_str(),_ios::app )_;
    if (f.fail())
_   cout_<<_"Unable to open file " <<_endl;
     _  else
  ___    _  Prefix(person, num_people);
  _  _  f << person.firstname << "_"_<<  person.lastname << " "_<<_person.country <<  " "