lundi 5 décembre 2016

display the results c++ program

I need help with setw(). I have this fumction :

void PrintRecord(PLAYER &m, ostream &cout) {

 cout << setw(3) << m.PlayerID << '\t' << m.LastName << ',' << setw(4)
    << m.FirstName;
if ( m.Hits > 0 || m.Walks > 0 || m.Outs > 0 )
{
    cout << "\t\t" << setprecision(3) << fixed << m.Hits << '\t'
        << m.Walks << '\t' << m.Outs << '\t' << m.BattingAvg
        << '\t' << m.OnBaseAvg << endl;
}
else
{
    cout << endl;
}

}

which is not printing my data in columns.

i want to print my data on alighn colmns,

thanks

Aucun commentaire:

Enregistrer un commentaire