previous | start | next

How to ...: 2

How can you create a format string instead of printing the previous heading?

#include <sstream>

string format()
{
  stringstream ss;

  ss.setf(ios::left, ios::adjustfield);
  ss << setw(15) << "Description";
  ss.setf(ios::right, ios::adjustfield);
  ss << setw(10) << "Qty"
       << setw(10) << "Price"
       << setw(10) << "Total" << endl;

  return ss.str();

}
     


previous | start | next