User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C section within the Software Development category of DaniWeb, a massive community of 402,582 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,315 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C advertiser: Programming Forums

Program help please

Join Date: Feb 2007
Posts: 66
Reputation: bigben09 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
bigben09 bigben09 is offline Offline
Junior Poster in Training

Re: Program help please

  #4  
Mar 27th, 2007
thanks man i got that to work. now if you could help me with one last thing, when it prints out the gross amout of money and the donated amout of money i need it to print out 2 decemal places. for example 100.00 or 100.34, either way i need to see 2 decimale places you got anything for me on that one. sometimes it prints out 1 decimal place and sometimes 3. what can I do.

#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;
}
Reply With Quote  
All times are GMT -4. The time now is 11:13 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC