i need help please


this is what i have so far...for some reason when i output the amount the number is too big for example "24443423.0" im confused.
Write a program that asks how
many tickets for each class of seats were sold, then displays the amount of income
generated from ticket sales. Format your dollar amount in xed-point notation, with
two decimal places of precision, and be sure the decimal point is always displayed

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
  float const seatA=15,seatB=12,seatC=9;    
    float tickets, total,seat;
    int TicketA, TicketB, TicketC;
    
    cout << setprecision(2)<< fixed << endl;
    
    cout << "how many ticket for each class were sold?"<< endl;
    cout << " ClassA, classB and classC"<< endl;
    cout << "please seperate your answer with a space" << endl;
    cin >> TicketA,TicketB,TicketC;
    
    total = (TicketA*seatA)+(TicketB*seatB)+(TicketC*seatC);
    
    cout << "the total dollar amount for ticket will be: $ "<<
          total<< endl;
Last edited on
try this instead :

cin >> TitcketA >> TicketB >> TicketC;

Topic archived. No new replies allowed.