问题描述
我一直在尝试使用setw方法格式化程序的输出,但是不能正常工作吗?这是我的输出,各县之间的差距很大(例如:美国):
我的代码如下:
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();
}
我想看看我能做些什么来弥补美国等国家之间的巨大差距。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)