フォーマット・フラグ showpos の設定によって、非負値の表示の先頭に + をつけるかどうかを決める。 #include <iostream.h> #include <iomanip.h> int main() { for (int i = 0; i <= 10; i++) { cout << setw(5) << - 1.0 + 0.2 * i; } cout << endl; cout.setf(ios::showpos); for (int i = 0; i <= 10; i++) { cout << setw(5) << - 1.0 + 0.2 * i; } cout << endl; return 0; }