getline Function Won't Work

getline Function Won't Work

Hi, I'm Programming In C++ For The First Time And I'm Trying To Make A Program That Creates A List Of Phone Numbers Using Pointers, Infile, Outfile Here's The Code:
**********************************************************************
Code:

/* PhoneMenu.cpp Adam Eidelsafy 11/1/2005*/

#include 
#include 
#include 
#include 
#include 
#include 
using namespace std;

int main ()
{

  int a, b, x, choice, change, size = 5; //Loop Control Variables
  char yes = 'y';
  char no = 'n';
  string name[80] = {"Tom","Mary","Jon","Rachel","John"}; //An Array For Names
  string phone[80] ={"555-3322","555-8976","555-1037","555-1400","555-8873"}; //An Array For #'s
  string call;
  string *pin;
  string *piu;
  string *pn;
  string *pp;

  ifstream in("Phone List.txt", ios::in | ios::binary);
  if(!in)
  {
     cout << "Cannot Open File.
";
     return 1;
  }

  for(x = 0; x < size; x++)
  {
     pin = &name[x];
     piu = &phone[x];

     cin.getline(in, *pin, ",");
     cin.getline(in, *piu, "
");
  }

  in.close();

  //Sorts Numbers In The Array
  for (a = 0; a < size; a++)
  {
     pn = &name[b];
     pp = &phone[b];
     for (b = size - 1; b > a; b--)
     {
        pn = &name[b];
        pp = &phone[b];

        if (name[b - 1] > name[b])
        {
           //If out of order exchange names
           swap(*(pn - 1), *pn);

           //If out of order exchange numbers
           swap(*(pp - 1), *pp);
        }

     }

  }


  //This Prints Out The Alphabetized Phone Lists
  cout << "Here's The Alphabetized Phone Numbers
";
  for (x = 0; x < 5; x++) cout << name[x] << " " << phone[x] << endl;

  while (yes == 'y')
  {
     cout << "
What Would You Like To Do:" << endl;
     cout << "1) Add A Name And Number" << endl;
     cout << "2) Call Up A Number" << endl;
     cout << "3) Change A Name Or A Number Or Both" << endl;
     cout << "4) Delete A Number" << endl;
     cin >> choice;
     no = 'n';

     switch(choice)
     {
        /********************************************************************************/
        /********************************************************************************/
        case 1:
           cout << "
Add The New Name (Remember Use Only One Word For A Name)" << endl;
           cin >> name[size];

           cout << "
Add The New Number(Remember The Program Will Read Up To Only One Space)" << endl;
           cin >> phone[size];
           size = size + 1;


           //Sorts Numbers In The Array
           for (a = 0; a < size; a++)
           {
              pn = &name[b];
              pp = &phone[b];
              for (b = size - 1; b > a; b--)
              {
                 pn = &name[b];
                 pp = &phone[b];

                 if (name[b - 1] > name[b])
                 {
                    //If out of order exchange names
                    swap(*(pn - 1), *pn);

                    //If out of order exchange numbers
                    swap(*(pp - 1), *pp);
                 }

              }

           }
           //This Prints Out The Alphabetized Phone Lists
           cout << "Here's The New Alphabetized Phone Numbers
";
           for (
x = 0; x < size; x++) cout << name[x] << " " << phone[x]<< endl;

           //Asks If User Would Like To Continue
           cout << "If You'd Like To Continue Enter 'y'" << endl;
           cin >> yes;
           break;

        /********************************************************************************/
        /********************************************************************************/
        case 2:
           cout << "Enter The Name Of The Person Whose Number You'd Like To Call Up" << endl;
           cin >> call;

           for(x = 0; x < size + 1; x++)
           {
              if(call == name[x])
              {
                 cout << "
The Number For The Person You Just Called Up Is: " << phone[x] << endl;
                 call = "";
                 break;
              }
              else if (x == size)
                 cout << "
Sorry, The Name Does Not Exist Try Again" << endl;
           }
           //Asks If User Would Like To Continue
           cout << "If You'd Like To Continue Enter 'y'" << endl;
           cin >> yes;
           break;

        /********************************************************************************/
        /********************************************************************************/
        case 3:
           while (no == 'n')
           {
              cout << "What Would You Like To Do?" << endl;
              cout << "1)Change A Name" << endl;
              cout << "2)Change A Number" << endl;
              cout << "3)Change Both" << endl;
              cin >> change;

              switch(change)
              {
                 /*********************************************************************/
                 case 1:
                    cout << "Enter The Name You'd Like To Replace" << endl;
                    cin >> call;

                    for(x = 0; x < size + 1; x++)
                    {
                       if(call == name[x])
                       {
                          name[x] = "";
                          cout << "
Change The Name "<< endl;
                          cin >> name[x];

                          call = "";
                          cout << "If You Wish To Continue Changing Names, Numbers, Or Both Enter 'n'" << endl;
                          cin >> no;
                          break;
                       }
                       else if (x == size)
                       {
                          cout << "
Sorry, The Name Does Not Exist Try Again" << endl;
                          cout << "If You Wish To Continue Changing Names, Numbers, Or Both Enter 'n'" << endl;
                          cin >> no;
                       }
                    }
                 break;

                 /*********************************************************************/
                 case 2:
                    cout << "Enter The Name Of Whose Phone Number You'd Like To Replace" << endl;
                    cin >> call;

                    for(x = 0; x < size + 1; x++)
                    {
                       if(call == name[x])
                       {
                          phone[x] = "";
                          cout << "
Change The Phone Number "<< endl;
                          cin >> phone[x];

                          call = "";
                          cout << "If You Wish To Continue Changing Names, Numbers, Or Bot
h Enter 'n'" << endl;
                          cin >> no;
                          break;
                       }
                       else if (x == size)
                       {
                          cout << "
Sorry, The Name Does Not Exist Try Again" << endl;
                          cout << "If You Wish To Continue Changing Names, Numbers, Or Both Enter 'n'" << endl;
                          cin >> no;
                       }
                    }
                 break;

                 /*********************************************************************/
                 case 3:
                    cout << "Enter The Name You'd Like To Replace" << endl;
                    cin >> call;

                    for(x = 0; x < size + 1; x++)
                    {
                       if(call == name[x])
                       {
                          name[x] = "";
                          cout << "
Change The Name "<< endl;
                          cin >> name[x];
                          call = "";

                          phone[x] = "";
                          cout << "
Change The Phone Number "<< endl;
                          cin >> phone[x];

                          call = "";
                          cout << "If You Wish To Continue Changing Names, Numbers, Or Both Enter 'n'" << endl;
                          cin >> no;
                          break;
                       }
                       else if (x == size)
                       {
                          cout << "
Sorry, The Name Does Not Exist Try Again" << endl;
                          cout << "If You Wish To Continue Changing Names, Numbers, Or Both Enter 'n'" << endl;
                          cin >> no;
                       }
                    }
                 break;
                 /*********************************************************************/
              }

           }
              //Sorts Numbers In The Array
              for (a = 0; a < size; a++)
              {
                 pn = &name[b];
                 pp = &phone[b];
                 for (b = size - 1; b > a; b--)
                 {
                    pn = &name[b];
                    pp = &phone[b];

                    if (name[b - 1] > name[b])
                    {
                       //If out of order exchange names
                       swap(*(pn - 1), *pn);

                       //If out of order exchange numbers
                       swap(*(pp - 1), *pp);
                    }

                 }

              }


              //This Prints Out The Alphabetized Phone Lists
              cout << "Here's The Alphabetized Phone Numbers
";
              for (x = 0; x < 5; x++) cout << name[x] << " " << phone[x] << endl;

              //Asks If User Would Like To Continue
              cout << "If You'd Like To Continue Enter 'y'" << endl;
              cin >> yes;
              break;

        /********************************************************************************/
        /********************************************************************************/
        case 4:
           cout << "Enter The Name You'd Like To Delete" << endl;
           cin >> call;

           for(x = 0; x < size + 1; x++)
           {
              if(call == name[x])
              {
                 name[x] = "";
                 phone[x] = "";

                 size = size - 1;
              }
              else if (x == size)
                 cout << "
Sorry, The Name Does Not Exist Try Again" << endl;

           }

           //Sorts Numbers In The Array
           for (a = 0; a < size; a++)
           {
              pn = &name[b];
              pp = &phone[b];
              for (b = size - 1; b > a; b--)
              {
                 pn = &name[b];
                 pp = &phone[b];

                 if (name[b - 1] > name[b])
                 {
                    //If out of order exchange names
                    swap(*(pn - 1), *pn);

                    //If out of order exchange numbers
                    swap(*(pp - 1), *pp);
                 }

              }

           }

           //This Prints Out The Alphabetized Phone Lists
           cout << "Here's The New Alphabetized Phone Numbers
";
           for (x = 0; x < size; x++) cout << name[x] << " " << phone[x]<< endl;

           //Asks If User Would Like To Continue
           cout << "If You'd Like To Continue Enter 'y'" << endl;
           cin >> yes;
           break;
        /********************************************************************************/
        /********************************************************************************/
        default:
           cout << "Not Funny, Enter A Correct Number" << endl;
           //Asks If User Would Like To Continue
           cout << "If You'd Like To Try Again Continue Enter 'y'" << endl;
           cin >> yes;
           break;
     }

  }

  ofstream out("Phone List.txt", ios::out | ios::binary | ios::trunc);
  if(!out)
  {
     cout << "Cannot Open File.
";
     return 1;
  }

  for(x = 0; x < size; x++)
  {
     out << name[x] << ", " << phone[x];
  }

  return 0;
}


**********************************************************************
But I Keep Getting These Errors(2)

F:Adam EidelsafyC++PhoneMenuIOPhoneMenuIO.cpp(37) : error C2664: 'class std::basic_istream > &__thiscall std::basic_istream >::getline(char *,int,char)' : cannot convert param
eter 1 from 'class std::basic_ifstream >' to 'char *'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called

F:Adam EidelsafyC++PhoneMenuIOPhoneMenuIO.cpp(38) : error C2664: 'class std::basic_istream > &__thiscall std::basic_istream >::getline(char *,int,char)' : cannot convert param
eter 1 from 'class std::basic_ifstream >' to 'char *'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
Error executing cl.exe.

And It's Driving Me Insane

1 post / 0 new
For more complete information about compiler optimizations, see our Optimization Notice.