• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 238
  • Last Modified:

How do i output data in columns using visual C++?

I'd like to output data in the following format;

Movie Name:................. Duckey goes to mars
No of tickets sold : ..........             2650
Gross amount: .......................$   9150.00
Percentage amount : .................         10%
Amount Donated : ....................$     915.00
Net Sale : ..........................$    8235.00


how can i do this using the left and right manipulators and the setfill function to fill the space in between(eg between Movie name and Duckey goes to mars) with the dots?
Pls help its so urgent......chilele.
0
chilele
Asked:
chilele
  • 3
  • 2
1 Solution
 
chileleAuthor Commented:
I'd need this ans urgently pls help....chilele
0
 
fsign21Commented:
//set fill
cout.fill('.');
cout.setf(ios::left,ios::adjustfield);

cout << setw(100) << "Movie Name:" << "Duckey goes to mars" << endl;

//NOTE: The field ios::width is reset to 0 immediately after every insertion.
0
 
fsign21Commented:
Just for completeness:

The statement
cout.fill('.');

can be replaced with the in-sequence manipulator
... << setfill('.') << ...


The manipulator
... << setw(100) << ...

can be replaced with
cout.width(100);

I always use statements like
cout.fill('.');
to set flags, which are not reset after "<<" because I can better see them...


0
 
fsign21Commented:
chilele, if you find that I answered your question, I would appreciate if you close the issue.
If not, you are welcome to ask more, write some comments or give any other kind of feedback.
0
 
chileleAuthor Commented:
My question has been answered,thanx so much fsign21.
Chilele.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now