0
所以我使用的iomanip
库来清点这样的:对齐问题<iomanip>
std::cout << std::endl
<< std::left << std::setw(15) << "Ticker Symbol"
<< std::setw(100) << "Stock Name"
<< std::setw(12) << "Value"
<< std::setw(10) << "Date"
<< std::setw(10) << "YTD Return"
<< std::endl;
的问题是,它结束了印刷本:
T icker SymbolS tock NameV alueD ateY TD Return
相反的:
Ticker Symbol Stock Name Value Date YTD Return
有没有一种方法可以解决这个问题,而无需使用其他库?
编辑:我的操作符重载函数似乎是造成这个问题:
std::ostream& operator<< (std::ostream& out, const char array[])
{
for (uint8_t i = 0; array[i] != '\0'; i++)
{
out << array[i];
}
return out;
}
话虽这么说,我还是不知道如何解决这个问题。
在黑暗中拍摄:在没有写之间帮助刷新流? –
把'std :: cout.flush();'放在代码之前什么都不做。 – LarryK
[Can not Reproduce](http://coliru.stacked-crooked.com/a/9f71dfe3af6aa51f) – NathanOliver