(C++) std::showpos

January 11, 2018 · View on GitHub

 

 

 

 

 

(C++) std::showpos

 

std::showpos is a stream modifier to prepend positive values by a plus.

 


#include <iostream> int main() {   const int i = 1;   std::cout     << std::showpos   << i << '\n'     << std::noshowpos << i << '\n'; }

 

Screen output:

 


+1 1

 

 

 

 

 

 

Contents

  1. 1int main() { const int i = 1; std::cout #include &#x3C;iostream> int main() { const int i = 1; std::cout &#x3C;&#x3C; std::showpos &#x3C;&#x3C; i &#x3C;&#x3C; '\n' &#x3C;&#x3C; std::noshowpos &#x3C;&#x3C; i &#x3C;&#x3C; '\n'; }
  2. 2+1 1