Having Trouble With Setfill

Write your question here.

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
  #include<iostream>
#include<iomanip>
#include<string>
using namespace std;

int main()
{
	double TotalTix, ANum, NNum;
	double Gross, PDon,Profit , Don, ATix, Ntix;
	string MovieName;
	
	cout << fixed << showpoint << setprecision(2);

	cout << "This is Movie Problem Tix in class problem" << endl;
	cout << "Please enter the name of the movie: " << endl;
	getline(cin, MovieName);
	cout << " Enter the price of the Adult Ticket: " << endl;
	cin >> ATix;
	cout << "Enter the price for a child ticket" << endl;
	cin >> Ntix;
	cout << "Enter the Number of Adult Tickets sold" << endl;
	cin >> ANum;
	cout << "Enter the amount of child tickets sold" << endl;
	cin >> NNum;
	cout << "Please enter the total percentage (In Decimal Form) donated" << endl;
	cin >> PDon;

	TotalTix = ATix + Ntix;
	Gross = ATix * ANum + Ntix * NNum;
	Don = Gross * PDon;
	Profit = Gross - Don;

	cout << "-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*"
		<< "-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*" << endl;
	cout << setfill('.') << left << setw(35) << "Movie Name: " << right << " " << MovieName << endl;
	cout << setfill('.') << left << setw(35) << "Number of tickets sold: " << setfill(' ') << right << setw(10) << TotalTix << endl;
	cout << setfill('.') << left << setw(35) << "Gross Amount: " << setfill(' ') << right << " $" << setw(8) << Gross << endl;
	cout << setfill('.') << left << setw(35) << "Percentage of Gross Amount Donated: " << setfill(9) << PDon << '%' << endl;
	cout << setfill('.') << left << setw(35) << "Amount Donated: " << setfill(' ') << right << " $" << setw(8) << Don << endl;
	cout << setfill('.') << left << setw(35) << "Net Sale: " << setfill(' ') << right << " $" << setw(8) << Profit << endl;

	

	system("PAUSE");
	return 0;
}


I am getting Wrong Character type for setfill. Not sure why its saying it but is probably from something I forgot to do.
Read line 38 ... CAREFULLY.
 
cout << setfill('.') << left << setw(35) << "Percentage of Gross Amount Donated: " << setfill(9) << PDon << '%' << endl;

setfill(9) should be setw(9)
Also Missing: setfill(' ') << right at the end of the string statement

Thank Yuo!!!
Topic archived. No new replies allowed.