A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://en.cppreference.com/w/cpp/algorithm/../ranges/../algorithm/../io/manip/showpos.html below:

std::showpos, std::noshowpos - cppreference.com

Enables or disables the display of the plus sign '+' in non-negative integer output. Has no effect on input.

This is an I/O manipulator, it may be called with an expression such as out << std::showpos for any out of type std::basic_ostream or with an expression such as in >> std::showpos for any in of type std::basic_istream.

[edit] Parameters str - reference to I/O stream [edit] Return value

str (reference to the stream after manipulation).

[edit] Example
#include <iostream>
 
int main()
{
    std::cout
        << "showpos: " << std::showpos << 42 << ' ' << 3.14 << ' ' << 0 << '\n'
        << "noshowpos: " << std::noshowpos << 42 << ' ' << 3.14 << ' ' << 0 << '\n';
}

Output:

showpos: +42 +3.14 +0
noshowpos: 42 3.14 0
[edit] See also

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4