Aligning Columns using setw(5)

  alignment, c++, setw, string, tabs
void BookRecord::printRecord()
{
for (int i = 0; i < strlen(m_sName); i++)
    cout << *(m_sName + i);
cout << setw(5);  added setw(5) to get most to align
cout << "tt" << m_lStockNum << "t"
    << m_iClassification << "t"
    << m_dCost << "t"
    << m_iCount << endl;

I have attached the output of my code. The "C++ Programming for Dummies I cannot get to align.

enter image description here

Source: Windows Questions C++

LEAVE A COMMENT