fork(6) download
  1. #include <iomanip>
  2. #include <iostream>
  3. #include <sstream>
  4.  
  5. int main()
  6. {
  7. std::ostringstream stream;
  8. stream << std::showpos; // Always show sign
  9. stream << std::setw(3); // Minimum 3 characters
  10. stream << std::setfill( '0' ); // Zero-padded
  11. stream << 1; // Expected output: "+01"
  12.  
  13. std::cout << stream.str(); // Output: "0+1"
  14. return 0;
  15. }
  16.  
Success #stdin #stdout 0s 16048KB
stdin
Standard input is empty
stdout
0+1