Program with fixed notation help

This is the program I am working on:

Write a program that will input the amount of chairs sold for each style. It
will print the total dollar sales of each style as well as the total sales of all chairs in fixed point notation with two decimal places.

The program runs fine I am just have problems with the output.
I have tried a few different methods for the fixed point notation, but I am getting results like 324.5 rather than 324.50?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63

#include <iostream>


using namespace std;

int main()

{    
       //Declares variables for chairs
       float americanColonial;
	float modern;
	float frenchClassical;

	//Sets the price for the chairs
	americanColonial =  85.00;
	modern           =  57.50;
	frenchClassical  = 127.75;
	
	//Declares variables for number of chairs sold
	int numOfAmericanColonial;
	int numOfModern;
	int numOfFrenchClassical;
	
	float total;
	

	
	//Prompts the user for the number of chairs
	cout << "Please input the number of American Colonial chairs sold: ";
	cin  >> numOfAmericanColonial;
	cout << endl;
	
	cout << "Please input the amount of Modern chairs sold: ";
	cin  >> numOfModern;
	cout << endl;
	
	cout << "Please input the number of French Classical chairs sold: ";
	cin  >> numOfFrenchClassical;
	cout << endl;
	
	//Calulates the totals and prints the results
       cout << "The total sales of American Colonial chairs: $" << numOfAmericanColonial *         americanColonial << endl;
       cout << endl;
	
	cout << "The total sales of Modern chairs: $" << numOfModern * modern << endl;
	cout << endl;
	
	cout << "The total sales  French Classical: $" << numOfFrenchClassical *    frenchClassical << endl;
	cout << endl;
	
	total = (numOfAmericanColonial * americanColonial) + (numOfModern * modern) +  (numOfFrenchClassical * frenchClassical);
	
	
	cout << "The total sales of all chairs: $" << total << endl;
	cout << endl;
	
	system ("pause");
	
	return 0;

} 
Last edited on
Topic archived. No new replies allowed.