I been trying to format my output from my program using setw method but is not working? This is my output, big gaps between countires (ex: United States):
My code looks like this:
string itemToString(const Country& i) {
ostringstream out;
out.setf(ios::fixed);
out.setf(ios::showpoint);
out.precision(2);
out << i.name
<< setw(20) << "|" << i.population
<< setw(10) << "|" << i.areaSQ
<< setw(10) << "|" << i.popDensitySQ
<< setw(10) << "|" << i.netMigration
<< setw(10) << "|" << i.GDP
<< setw(10) << "|" << i.literacy
<< setw(10) << "|" << i.birthRate << "\n";
return out.str();
}
I want to see if there is anything that I can do to fix those big gaps between countries like United States.