Program Shuts Down

The program shuts down after i input the adult tickets and press enter.

Not sure what I missed.


#include <iostream>
#include <iomanip>

using namespace std;

void main()
{
cout << "Box Office Program\n";

double totalChild, totalAdult, grossProfit, netProfit, distributorAmt;
int childTkts, adultTkts;

cout << "Please Enter Number of Chid Tickets: ";
cin >> childTkts;
cout << "Please Enter Number of Adult Tickets: ";
cin >> adultTkts;
totalChild = 6 * childTkts;
totalAdult = 10 * adultTkts;

grossProfit = totalChild + totalAdult;
netProfit = grossProfit * 0.2;
distributorAmt = grossProfit - netProfit;

cout << left << setw(25) << "Gross Box Office Profit: " << "$" << grossProfit << right << setw(10) << endl;
cout << left << setw(25) << "Net Box Office Profit: " << "$" << netProfit << right << setw(10) << endl;
cout << left << setw(26) << "Amount Paid to Distributor: " << "$" << distributorAmt << right << setw(10) << endl;


}
I tried both the coding options offered by helios's link, but no luck. Although they helped in showing me that the bottom half of my code, from "cin >> adultTkts" to the very end, is not being recognized/activated.

I am quite sure it some simple code or text I missed, didnt enter, or miswrote.
Box Office Program
Please Enter Number of Chid Tickets: 2
Please Enter Number of Adult Tickets: 3
Gross Box Office Profit: $42
Net Box Office Profit:   $8.4
Amount Paid to Distributor: $33.6

Other than the void main(), the code is fine. You're just not running it properly. Read that thread thoroughly, this subject has been covered extensively already.
At risk of repeating helios:

The program shuts down after i input the adult tickets and press enter.
Looking at your code, that's what it's meant to do. You press enter, it churns through the rest of the code doing some things, which then comes to an end, so then the program shuts down. It's doing exactly what you told it to.
Topic archived. No new replies allowed.