RSS Forums RSS
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

Program help please

  #1  
Mar 27th, 2007
Hey I want to be able to put a movie title in the is more than one world and it goes crazy when i do, if you run my program and enter one word when it asks for the movie title it will work fine. but when u enter a more than one word (using space) it goes crazy and ends the program. what do i need to do.

#include "stdafx.h"
#include <iostream>
#include <ctype.h>
using namespace std;
int main()
{
 char movie[50];
 int adult_ticket_price, child_ticket_price;
 int adult_ticket_sold, child_ticket_sold;
 int percentage_of_gross_amount_donated;
 
 cout <<"Enter The Movie Name: ";
 cin >> 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;
}
AddThis Social Bookmark Button
Reply With Quote  
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 4:33 am.
Newsletter Archive - Sitemap - Privacy Statement - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC