?
Solved

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

Posted on 2003-03-24
5
Medium Priority
?
224 Views
Last Modified: 2010-04-01
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
Comment
Question by:chilele
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 

Author Comment

by:chilele
ID: 8195653
I'd need this ans urgently pls help....chilele
0
 
LVL 1

Accepted Solution

by:
fsign21 earned 200 total points
ID: 8195985
//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
 
LVL 1

Expert Comment

by:fsign21
ID: 8196082
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
 
LVL 1

Expert Comment

by:fsign21
ID: 8204677
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
 

Author Comment

by:chilele
ID: 8209125
My question has been answered,thanx so much fsign21.
Chilele.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question