Hey what dod i need to do inorder to get my program to print out 2 decimal places after gross amount and amount donated? you will see what i mean when u run my program. for example i need it to print out $100.00 not just $100.

#include "stdafx.h"
#include <iostream>
#include <ctype.h>
using namespace std;
int main()
{
 char movie[50];
 float adult_ticket_price, child_ticket_price;
 float adult_ticket_sold, child_ticket_sold;
 float percentage_of_gross_amount_donated;
 
 cout <<"Enter The Movie Name: ";
 cin.getline( movie, sizeof(movie)); 
 cout << "";
 cout <<"Enter The Adult Ticket Price: $";
 cin >> adult_ticket_price;
 cout << "";
 cout <<"Enter The child ticket price: $";
 cin >> child_ticket_price;
 cout << "";
 cout <<"Enter The Number of Adult Tickets Sold: ";
 cin >> adult_ticket_sold;
 cout << "";
 cout <<"Enter The Number of Child Tickets Sold: ";
 cin >> child_ticket_sold;
 cout << "";
 cout <<"Enter The Percentage of Gross Amount Donated: ";
 cin >> percentage_of_gross_amount_donated;
 cout << "";
 cout <<"Number of Tickets Sold: " << ((adult_ticket_sold)+(child_ticket_sold))<< endl;
 cout <<"Gross Amout is: $" << (((adult_ticket_sold)*(adult_ticket_price))+((child_ticket_sold)*(child_ticket_price))) << endl;
cout <<"Amount Donated is: $" << ((((adult_ticket_sold)*(adult_ticket_price))+((child_ticket_sold)*(child_ticket_price)))*((percentage_of_gross_amount_donated)*(.01)));
 cout <<" "<<endl;
 return 0;
}

Hi try with this.... may be it can help you.

#include "stdafx.h"
#include <iostream>
#include <ctype.h>
#include <iomanip>

using namespace std;
int main()
{
	char movie[50];
	float adult_ticket_price, child_ticket_price;
	float adult_ticket_sold, child_ticket_sold;
	float percentage_of_gross_amount_donated;
	cout <<"Enter The Movie Name: ";
	cin.getline( movie, sizeof(movie)); 
	cout << "";
	cout <<"Enter The Adult Ticket Price: $";
	cin >> adult_ticket_price;
	cout << "";
	cout <<"Enter The child ticket price: $";
	cin >> child_ticket_price;
	cout << "";
	cout <<"Enter The Number of Adult Tickets Sold: ";
	cin >> adult_ticket_sold;
	cout << "";
	cout <<"Enter The Number of Child Tickets Sold: ";
	cin >> child_ticket_sold;
	cout << "";
	cout <<"Enter The Percentage of Gross Amount Donated: ";
	cin >> percentage_of_gross_amount_donated;
	cout << "";
	cout.precision(2);
	cout <<"Number of Tickets Sold: " << fixed << ((adult_ticket_sold)+(child_ticket_sold))<< endl;
	cout <<"Gross Amout is: $" << fixed << (((adult_ticket_sold)*(adult_ticket_price))+((child_ticket_sold)*(child_ticket_price))) << endl;
	cout <<"Amount Donated is: $" << fixed << ((((adult_ticket_sold)*(adult_ticket_price))+((child_ticket_sold)*(child_ticket_price)))*((percentage_of_gross_amount_donated)*(.01)));
	cout <<" "<<endl;
	return 0;
}

Hasn't anyone mentioned code formatting yet? You need to indent your code so we can follow it.

And your titles need work -- see this. Any more lame titles also warrants an infraction.

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.