how to make `ConfirmChoice`function cancel from `main if it is false?
<p>I need to make<code>ConfirmChoice</code> cancel  from the main function before it starts the rest of the code. I have tried a lot and can not figure this out.</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;iomanip&gt;
using namespace std;

const char CASH = 'C';
const char CREDIT = 'D';
const char NOSEBLEED = 'N';
const char BOX_SEAT = 'B';
const char FIFTY_YARD_LINE = 'F';
const char STUDENT_SECTION = 'S';
const float NOSEBLEED_PRICE = 43.42;
const float BOX_SEAT_PRICE = 353.85;
const float FIFTY_YARD_LINE_PRICE = 94.05;
const float STUDENT_SECTION_PRICE = 19.99;

//---------------------------------------------------------------
// Function: ConfirmChoice
// Purpose:  Confirms the users ticket purchase before processing payment
// Parameters:  TicketType - The type of ticket selected
// Returns:  true if the user confirms the selection, false otherwise
//--------------------------------------------------------------
bool ConfirmChoice(const char TicketType)
{
   char Choice;
   bool Confirmed;

   // Print out their selection
   cout &lt;&lt; "\nYou have chosen to purchase ";
   cout &lt;&lt; fixed &lt;&lt; setprecision(2);
   switch (TicketType)
   {
   case NOSEBLEED:
      cout &lt;&lt; "Nosebleed ticket(s) at a price of $";
      cout &lt;&lt; NOSEBLEED_PRICE &lt;&lt; ".\n";
      break;
   case BOX_SEAT:
      cout &lt;&lt; "Box Seat ticket(s) at a price of $";
      cout &lt;&lt; BOX_SEAT_PRICE &lt;&lt; ".\n";
      break;
   case FIFTY_YARD_LINE:
      cout &lt;&lt; "Ticket(s) on the 50 yard line at a price of $";
      cout &lt;&lt; FIFTY_YARD_LINE_PRICE &lt;&lt; ".\n";
      break;
   case STUDENT_SECTION:
      cout &lt;&lt; "Ticket(s) in the Student Section at a price of $";
      cout &lt;&lt; STUDENT_SECTION_PRICE &lt;&lt; ".\n";
      break;
   }

   // Confirm the selection
   cout &lt;&lt; "Do you wish to confirm your purchase? Enter Y or N: ";
   cin &gt;&gt; Choice;
   Choice = toupper(Choice);
   while (Choice != 'Y' &amp;&amp; Choice != 'N')
   {
      cout &lt;&lt; "Invalid selection.  Please enter either Y or N: ";
      cin &gt;&gt; Choice;
      Choice = toupper(Choice);
   }
   Confirmed = (Choice == 'Y');

   // Check confirmation        
   if (Confirmed)
      cout &lt;&lt; "You have confirmed your choice.\n" &lt;&lt; endl;
   else
      cout &lt;&lt; "You not confirmed your choice.\n" &lt;&lt; endl;
   return (Confirmed);
}

//-------------------------------------------
// Function: CalculateChange
// Purpose:  To output the change due
// Parameters:  ChangeDue - The amount of change needed 
// Returns:  Nothing
//-------------------------------------------
void CalculateChange(const float ChangeDue)
{
   int Change = 0;
   int Dollars = 0;
   int Quarters = 0;
   int Dimes = 0;
   int Nickels = 0;
   int Pennies = 0;

   // Compute change  
   Change = ChangeDue * 100;
   Dollars = Change / 100;
   Change = Change % 100;
   Quarters = Change / 25;
   Change = Change % 25;
   Dimes = Change / 10;
   Change = Change % 10;
   Nickels = Change / 5;
   Pennies = Change % 5;

   // Print out change
   cout &lt;&lt; "Your change is \n\t";
   cout &lt;&lt; Dollars &lt;&lt; " Dollars\n\t";
   cout &lt;&lt; Quarters &lt;&lt; " Quarters\n\t";
   cout &lt;&lt; Dimes &lt;&lt; " Dimes\n\t";
   cout &lt;&lt; Nickels &lt;&lt; " Nickels\n\t";
   cout &lt;&lt; Pennies &lt;&lt; " Pennies\n";
}

 int main()
{   
   // Prints my name and UAID
        cout &lt;&lt;"\n\nName: Ivory Newbern\n";
        cout &lt;&lt; "UAID: 010563918\n";

   // Declarations 

   char TChoice ;       // Ticket type: Nosebleed, box seats etc.. 
   char PChoice = GetPaymentType();     // Payment choice: cash or credit card
   bool Confirmed ;     // Did the user confirm the selection
   float Cost ;         // The cost of the ticket puchased
   float ChangeDue;     // The amount of change owed (for cash purchases)



   // Get the choice of payment type
    PChoice;

   // Get the choice of ticket type
    GetTicketType( TChoice);
   // Confirm the selection
    ConfirmChoice( TChoice);

    // If they confirm the purchase


      // Calls functions to figure out the price of ticket purchase(s) 

           if (TChoice == BOX_SEAT)
               Cost = CalculateCost(BOX_SEAT_PRICE);
           if (TChoice == NOSEBLEED)
               Cost = CalculateCost(NOSEBLEED_PRICE);
           if (TChoice == STUDENT_SECTION)
               Cost = CalculateCost(STUDENT_SECTION_PRICE);
           if (TChoice == FIFTY_YARD_LINE)
               Cost = CalculateCost(FIFTY_YARD_LINE_PRICE);

      // Handles the payment 

           if( PChoice == 'C');
                PayWithCash(Cost,ChangeDue) , CalculateChange(ChangeDue);
           if( PChoice == 'D')
                PayWithCredit(Cost);

       // Say goodbye to the customer
           if (TChoice == BOX_SEAT)
           cout &lt;&lt; "Thank you for the purchase of your 'BOX_SEAT' tickets ,have a nice day!" &lt;&lt; endl;
           if (TChoice == NOSEBLEED)
              cout &lt;&lt; "Thank you for the purchase of your 'NOSEBLEED' tickets ,have a nice day!" &lt;&lt; endl; 
           if (TChoice == STUDENT_SECTION)
              cout &lt;&lt; "Thank you for the purchase of your 'STUDENT_SECTION' tickets ,have a nice day!" &lt;&lt; endl;
           if (TChoice == FIFTY_YARD_LINE)
                cout &lt;&lt; "Thank you for the purchase of your 'FIFTY_YARD_LINE' tickets ,have a nice day!" &lt;&lt; endl;


   // Else

      // Cancel the purchase 
    system ("PAUSE");
   return 0;
}
</code></pre>
