I am inputing from a text file, displaying it on the screen, displaying the menus and the choosing from there. It will repeat the menu, but, how to do I get it to read the next line in my input file and display it to the screen before repeating the menu?

Here's what I have.

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

using namespace std;

//Function Prototypes
void accept (char letter);
void transfer (char letter);
void decline (char letter);
int menu ();

int main()
{
        
    
    const int SIZE = 100; //Length of line
    char first[SIZE], last[SIZE], phone[SIZE], status;
    int X, pref;
    
    ifstream inputFile; //File Stream Object
    inputFile.open ("c:\\potentials.txt", ios::in);  //Open File
    
   
    if (inputFile.fail()) //Error Opening File
   { 
      cout << "Error opening file. The file could not be found.\n";
      cout <<""<<endl;
      system ("PAUSE");
      return EXIT_FAILURE;  
   }

    // Determine status
    inputFile >> status;
    if (status == 'X' || status == 'x')
   {
      cout << "Preferred -- 7.9%" << endl;
      pref=0;
   }  
    else 
   {
      cout << "12.9%" << endl; 
      pref=1;
   }
    
    // Get name
    inputFile >> first >> last;
    cout << first << " " << last << endl;    
    
    // Get phone number
    inputFile >> phone;
    cout << phone << endl;
    cout << "" << endl;

   char letter;
    
    do
    {
        letter = menu ();
        switch (letter)
        {
            case 'A':  accept ('A');
                       break; 
            case 'a':  accept ('a');
                       break;
            case 'T':  transfer ('T');
                       break;
            case 't':  transfer ('t');
                       break;
            case 'D':  decline ('D');
                       break;
            case 'd':  decline ('d');
                       break;
        }
    }   while (1);
    return 0;    
}

//******************************************************************************
// Definition of function menu.                                                *
// Displays the menu and asks user to select an option.                        *
//******************************************************************************

int menu ()
{
    char letter;
    
    cout << "Please press the corresponding letter for the option you would like:" << endl;
    cout << "" << endl;
    cout << "A -- Accept the credit card" << endl;
    cout << "T -- Transfer a balance" << endl;
    cout << "D -- Decline the card" << endl;
    cout << "" << endl;
    cout << "Please enter your choice:" << endl;
    cin  >> letter;
    cout << "" << endl;
    while ((letter == 'T' || letter == 't') && (letter =='A' || letter =='a') && (letter == 'D' || letter == 'd'))
    {
       cout << "Invalid Selection.  Enter A, T or D:" << endl;
       cin >> letter;
    }
    return letter;
}

//******************************************************************************
// Definition for letter choice A.                                             *
// This function is for customers who choose to accept the card offer.         *
//******************************************************************************

void accept (char letter)
{
      
      const int SIZE = 100; //Length of line
      char address[SIZE];

     {
        cout << "Ask the customer for their address and enter it here: " << endl;
        cin  >> address;
        cout << "" << endl;
        cout << "Tell The customer, ' Thank you for your order today, expect" << endl; 
        cout << " your card to arrive in the mail soon, happy charging.'" << endl;
        cout << endl;
     } 
}

//******************************************************************************
// Definition for letter choice T.                                             *
// This function is for customers who choose to accept the card offer.         *
//******************************************************************************

void transfer (char letter)
{
      const int SIZE = 100; //Length of line
      char address[SIZE], status, pfc, y, Y;
      float tamount;
      
      cout << "Is this a Preferred Customer?" << endl;
      cin  >>  pfc;
             
      while(pfc == 'y' || pfc == 'Y')   
      {
        cout << "There is no transfer limit.  How much would you like to transfer?" << endl;
        cin  >> tamount;
        cout << "" << endl;
        cout << "Ask the customer for their address and enter it here: " << endl;
        cin  >> address;
        cout << "" << endl;
        cout << "Tell The customer, ' Thank you for your order today, expect";
        cout << " your card to arrive in the mail soon, happy charging.'" << endl;
        cout << endl;
      }
      if (pfc !='y' || pfc !='Y')
      {
        cout << "There is a transfer limit of $1000.  How much would you like to transfer?" << endl;
        cin  >> tamount;
      }
         if (tamount <=1000)
        {
          cout << "" << endl;
          cout << "Ask the customer for their address and enter it here: " << endl;
          cin >> address;
          cout << "" << endl;
          cout << "Tell The customer, ' Thank you for your order today, expect";  
          cout << " your card to arrive in the mail soon, happy charging.'" << endl;
          cout << endl;
        }
        else if (tamount >1000)
        {
          cout << "You have entered an amount over the transfer limit, please try again." << endl;
          cin  >> tamount;          
          cout <<""<<endl;
          
        }
} 

//******************************************************************************
// Definition for letter choice D.                                             *
// This function is for customers who choose to accept the card offer.         *
//******************************************************************************

void decline (char letter)
{
      // <- A local variable, uninitialized
      char status, pfc;  // <- A local variable, uninitialized

      cout << "Is this a Preferred Customer?" << endl;
      cin  >>  pfc;
      cout << "" << endl;
      
      if (pfc == 'Y' || pfc == 'y')
      {
        cout << "Tell the customer, 'There are amazing cash back rewards available to you!" << endl;
        cout << "Please call 888-555-1234 for a deal you won't be able to pass on!" << endl;
        cout << "" << endl;
      }
      else 
      {
        cout << "Thank you for your time and consideration.  Goodbye." << endl;
        cout << "" << endl;
      }  
}

Place all the code you want to repeat each time new stuff is read from the file inside the body of a loop, maybe lines 34 through 76, or something like that. Use line 35 as the controlling condition for the loop to run by placing it between the parenthesis of a while loop.

Thanks, I got it working.

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

using namespace std;

//Function Prototypes
void accept (char letter);
void transfer (char letter);
void decline (char letter);
int menu ();

int main()
{
        
    
    const int SIZE = 100; //Length of line
    char first[SIZE], last[SIZE], phone[SIZE], status, address[SIZE];
    int X, pref, tamount;
    
    ifstream inputFile; //File Stream Object
    inputFile.open ("c:\\potentials.txt", ios::in);  //Open File
    
   
    if (inputFile.fail()) //Error Opening File
   { 
      cout << "Error opening file. The file could not be found.\n";
      cout <<""<<endl;
      system ("PAUSE");
      return EXIT_FAILURE;  
   }
   
    ofstream outputFile;  //File to output to
    outputFile.open ("c:\\confirmed.txt", ios::out);
    
    if (outputFile.fail()) //Error Opening File
   { 
     cout << "Error opening file. The file could not be found.\n";
     cout <<""<<endl;
     system ("PAUSE");
     return EXIT_FAILURE;  
   }

  do
    {
    system ("CLS");        
    cout << "Customer Call list:" << endl;
    cout << " " << endl;
    
    // Determine status
    inputFile >> status;
    if (status == 'X' || status == 'x')
   {
      cout << "Preferred Customer offer a 7.9% interest rate!" << endl;
      pref=0;
   }  
    else 
   {
      cout << "Offer a 12.9% interest rate!" << endl; 
      pref=1;
   }  
    
    // Get name
    inputFile >> first >> last;
    cout << first << " " << last << endl;    
    
    // Get phone number
    inputFile >> phone;
    cout << phone << endl;
    cout << "" << endl;
    cout << "" << endl;
    cout << "" << endl;

   char letter;
   
    
        letter = menu ();
        switch (letter)
        {
            case 'A':  accept ('A');
                       cin.getline (address, SIZE);
                       outputFile << first << " " << last << " " << status << " " << address << " " << "New Card" << endl;
                       break; 
            case 'a':  accept ('a');
                       cin.getline (address, SIZE);
                       outputFile << first << " " << last << " " << status << " " << address << " " << "New Card" << endl;
                       break;
            case 'T':  transfer ('T');
                       cin.getline (address, SIZE);
                       outputFile << first << " " << last << " " << status << " " << address << " " << "Transfer: "<< tamount << endl;
                       break;
            case 't':  transfer ('t');
                       cin.getline (address, SIZE);
                       outputFile << first << " " << last << " " << status << " " << address << " " << "Transfer: "<< tamount << endl;
                       break;
            case 'D':  decline ('D');
                       cin.ignore ();
                       break;
            case 'd':  decline ('d');
                       cin.ignore ();
                       break;
        }
    }   while (1);
    return 0;    
}

//******************************************************************************
// Definition of function menu.                                                *
// Displays the menu and asks user to select an option.                        *
//******************************************************************************

int menu ()
{
    char letter;
    
    cout << "Please press the corresponding letter for the option you would like:" << endl;
    cout << "" << endl;
    cout << "A -- Accept the credit card" << endl;
    cout << "T -- Transfer a balance" << endl;
    cout << "D -- Decline the card" << endl;
    cout << "" << endl;
    cout << "Please enter your choice:" << endl;
    cin  >> letter;
    cout << "" << endl;
    while ((letter == 'T' || letter == 't') && (letter =='A' || letter =='a') && (letter == 'D' || letter == 'd'))
    {
       cout << "Invalid Selection.  Enter A, T or D:" << endl;
       cin >> letter;
    }
    return letter;
}

//******************************************************************************
// Definition for letter choice A.                                             *
// This function is for customers who choose to accept the card offer.         *
//******************************************************************************

void accept (char letter)
{
        
        const int SIZE = 100; //Length of line
        char address[SIZE];

          
        cout << "Ask the customer for their address and enter it here: " << endl;
        cin.ignore ();
        cin.getline (address, SIZE);
        system ("CLS");
        cout << "Tell The customer, ' Thank you for your order today, expect" << endl; 
        cout << " your card to arrive in the mail soon, happy charging.'" << endl;
        cout << " " << endl;
        cout << "Press ENTER key for next customer." << endl;
}

//******************************************************************************
// Definition for letter choice T.                                             *
// This function is for customers who choose to accept the card offer.         *
//******************************************************************************

void transfer (char letter)
{
      const int SIZE = 100; //Length of line
      char address[SIZE], status, pfc, y, Y;
      int tamount;
      
      cout << "Is this a Preferred Customer?" << endl;
      cin  >>  pfc;
             
      if (pfc == 'y' || pfc == 'Y')   
      {
        cout << "There is no transfer limit.  How much would you like to transfer?" << endl;
        cin  >> tamount;
        cout << "" << endl;
        cout << "Ask the customer for their address and enter it here: " << endl;
        cin.ignore ();
        cin.getline (address, SIZE);
        cout << "" << endl;
        cout << "Tell The customer, ' Thank you for your order today, expect";
        cout << " your card to arrive in the mail soon, happy charging.'" << endl;
        cout << " " << endl;
        cout << "Press ENTER key for next customer." << endl;
      }
      else  
      {
        cout << "There is a transfer limit of $1000.  How much would you like to transfer?" << endl;
        cin  >> tamount;
      
        if (tamount <=1000)
        {
          cout << "" << endl;
          cout << "Ask the customer for their address and enter it here: " << endl;
          cin.ignore ();
          cin.getline (address, SIZE);
          system ("CLS");
          cout << "Tell The customer, ' Thank you for your order today, expect";  
          cout << " your card to arrive in the mail soon, happy charging.'" << endl;
          cout << " " << endl;
          cout << "Press ENTER key for next customer." << endl;
        }
        if (tamount >1000)
        {
          cout << "You have entered an amount over the transfer limit, please enter an amount up to $1000." << endl;
          cin  >> tamount;          
          cout <<""<<endl;  
          cout << "Ask the customer for their address and enter it here: " << endl;
          cin.ignore ();
          cin.getline (address, SIZE);
          system ("CLS");          
          cout << "Tell The customer, ' Thank you for your order today, expect";  
          cout << " your card to arrive in the mail soon, happy charging.'" << endl;
          cout << " " << endl;
          cout << "Press ENTER key for next customer." << endl;
        }
      }
} 

//******************************************************************************
// Definition for letter choice D.                                             *
// This function is for customers who choose to accept the card offer.         *
//******************************************************************************

void decline (char letter)
{
      
      char status, pfc;  // <- A local variable, uninitialized

      cout << "Is this a Preferred Customer?" << endl;
      cin  >>  pfc;
      cout << "" << endl;
      system ("CLS");
      
      if (pfc == 'Y' || pfc == 'y')
      {
        cin.ignore ();    
        cout << "Tell the customer, 'There are amazing cash back rewards available to you! Don't miss out on this opportunity!'" << endl;
        cout << " " << endl;
        cout << "Please call 888-555-1234 for a deal you won't be able to pass on!" << endl;
        cout << "" << endl;
        cout << "Press ENTER key for next customer." << endl;
      }
      else 
      {
        cin.ignore ();
        cout << "Thank you for your time and consideration.  Goodbye." << endl;
        cout << " " << endl;
        cout << "Press any key for next customer." << endl;
      }  
}
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.