How to call void function from Main
<p>In my program I am trying to call the void function from Main but I can't figure out the correct way.</p>

<p><code>Main</code> is at the very bottom and <code>void GetTicketType(char &amp;Choice)</code> is the function I need to call to <code>cout</code> the ticket type.</p>

<pre><code>//---------------------------------------------------------------------------
// Purpose: This program simulates a ticket office for sporting events
// Author: TBA
// Date: TBA
//---------------------------------------------------------------------------
#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";
}

//---------------------------------------------------------------------------
// Function: CalculateCost
// Purpose: Calculate the cost of the ticket purchase(s) (num_tickets * price_per_ticket)
// Parameters: PricePerTicket - Ticket price based on the type of ticket
// Returns: The cost of purchasing the chosen number of tickets 
//---------------------------------------------------------------------------
float CalculateCost(const float PricePerTicket)
{
int TicketCount;
float Cost;

cout &lt;&lt; "How many tickets would you like? Please enter a positive integer value: ";
cin &gt;&gt; TicketCount;
while (TicketCount &lt; 0)
{
cout &lt;&lt; "Invalid entry. Please re-enter: ";
cin &gt;&gt; TicketCount;
}

Cost = PricePerTicket * TicketCount;
cout &lt;&lt; "Your bill is: $" &lt;&lt; fixed &lt;&lt; setprecision(2) &lt;&lt; Cost &lt;&lt; endl;
return Cost;
}

//---------------------------------------------------------------------------
// Function: GetPaymentType
// Purpose: Ask the user how they want to pay, cash or credit
// Parameters: None
// Returns: Value is CREDIT or CASH (global character constants) 
//---------------------------------------------------------------------------
char GetPaymentType()
{
char Choice;

// Print the main menu describing the ticket payment types 
cout &lt;&lt; "+-------------------------------------------------------+\n";
cout &lt;&lt; "+ Welcome to our Ticket Office +\n";
cout &lt;&lt; "+-------------------------------------------------------+\n";
cout &lt;&lt; endl &lt;&lt; endl;

// Cash or credit card (in upper case)
cout &lt;&lt; "How would you like to pay?\n";
cout &lt;&lt; "Enter C for cash or D for credit card: ";
cin &gt;&gt; Choice;
Choice = toupper(Choice);
while (Choice != CASH &amp;&amp; Choice != CREDIT)
{
cout &lt;&lt; "Invalid choice. Please enter C for cash or D for credit card: ";
cin &gt;&gt; Choice;
Choice = toupper(Choice);
}
return Choice;
}

//---------------------------------------------------------------------------
// Function: GetTicketType
// Purpose: Get the customer's choice between 4 types of tickets
// Parameters: Choice - Set to the user's choice
// Returns: Nothing
//---------------------------------------------------------------------------
void GetTicketType(char &amp;Choice)
{
// Ask the customer what type of ticket s/he prefers to buy 
cout &lt;&lt; "\nWhat type of ticket would you like?\n";
cout &lt;&lt; "\t" &lt;&lt; NOSEBLEED &lt;&lt; " for Nosebleed Section, Price = $";
cout &lt;&lt; NOSEBLEED_PRICE &lt;&lt; endl;
cout &lt;&lt; "\t" &lt;&lt; BOX_SEAT &lt;&lt; " for Box Seats, Price = $";
cout &lt;&lt; BOX_SEAT_PRICE &lt;&lt; endl;
cout &lt;&lt; "\t" &lt;&lt; FIFTY_YARD_LINE &lt;&lt; " for Seats on the Fifty Yard Line, Price = $";
cout &lt;&lt; FIFTY_YARD_LINE_PRICE &lt;&lt; endl;
cout &lt;&lt; "\t" &lt;&lt; STUDENT_SECTION &lt;&lt; " for Student Section, Price = $";
cout &lt;&lt; STUDENT_SECTION_PRICE &lt;&lt; endl;

// Get ticket choice (in upper case)
cout &lt;&lt; "Enter choice: ";
cin &gt;&gt; Choice;
Choice = toupper(Choice);   
while (Choice != NOSEBLEED &amp;&amp; Choice != BOX_SEAT &amp;&amp; 
Choice != FIFTY_YARD_LINE &amp;&amp; Choice != STUDENT_SECTION)
{
cout &lt;&lt; "Invalid choice. Please re-enter: ";
cin &gt;&gt; Choice;
Choice = toupper(Choice);
}
}

//---------------------------------------------------------------------------
// Function: PayWithCash
// Purpose: Handles payment by cash. Asks the user for the money until
// they enter enough, then updates the ChangeDue parameter
// Parameters: Cost - The amount due for the purchase
// ChangeDue - The amount of change due to customer
// Returns: Nothing
//---------------------------------------------------------------------------
void PayWithCash(const float Cost, float &amp;ChangeDue)
{
float CashOffered;

// Pay in cash
cout &lt;&lt; "Please enter enough cash. Your bill is $" &lt;&lt; Cost &lt;&lt; ": $ ";
cin &gt;&gt; CashOffered;

// Check sufficiency
while (CashOffered &lt; Cost)
{
cout &lt;&lt; "That is not enough to pay for your purchase!\n"
&lt;&lt; " Please enter at least $" &lt;&lt; Cost &lt;&lt; ": ";
cin &gt;&gt; CashOffered;
}

// Calculate change
ChangeDue = CashOffered - Cost;
}

//---------------------------------------------------------------------------
// Function: PayWithCredit
// Purpose: Handles payment by credit. Basically, just prints a statement
// telling them that their card will be charged.
// Parameters: const float Cost - the amount due for the purchase
// Returns: Nothing
//---------------------------------------------------------------------------
void PayWithCredit(const float Cost)
{
cout &lt;&lt; "Your credit card will be billed for $" &lt;&lt; Cost &lt;&lt; ".\n";
}

//---------------------------------------------------------------------------
// Function: main
// Purpose: This is the main program that calls functions above.
// Parameters: None
// Returns: Nothing
//---------------------------------------------------------------------------
int main()
{
// Declarations 

char TChoice ;   // Ticket type: Nosebleed, box seats etc.. 
TChoice &lt;&lt; GetTicketType( &amp;TChoice);
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)

// Print your name and UAID

// Get the choice of payment type

// Get the choice of ticket type
GetTicketType(TChoice );
{
cout &lt;&lt; "You have chosen the " &lt;&lt; TChoice &lt;&lt; "tickets. " &lt;&lt;".\n";
}

// Confirm the selection

// If they confirm the purchase

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

// Be sure to use the named constants

// Handle the payment

// Say goodbye 

// Else

// Cancel the purchase 

return 0;
}
</code></pre>
