Namespaces
Variants

std:: showpos, std:: noshowpos

From cppreference.net
< cpp ‎ | io ‎ | manip
Input/output manipulators
Floating-point formatting
Integer formatting
Boolean formatting
Field width and fill control
Other formatting
showpos noshowpos
Whitespace processing
Output flushing
Status flags manipulation
Time and money I/O
(C++11)
(C++11)
(C++11)
(C++11)
Quoted manipulator
(C++14)
Definiert in Header <ios>
(1)
std:: ios_base & noshowpos ( std:: ios_base & str ) ;
(2)

Aktiviert oder deaktiviert die Anzeige des Pluszeichens '+' in nicht-negativen Ganzzahlausgaben. Hat keine Auswirkung auf die Eingabe.

1) Aktiviert das showpos -Flag im Stream str , als ob durch Aufruf von str. setf ( std:: ios_base :: showpos ) .
2) Deaktiviert das showpos -Flag im Stream str , als ob durch Aufruf von str. unsetf ( std:: ios_base :: showpos ) .

Dies ist ein I/O-Manipulator, er kann mit einem Ausdruck wie out << std :: showpos für jeden out vom Typ std::basic_ostream oder mit einem Ausdruck wie in >> std :: showpos für jeden in vom Typ std::basic_istream aufgerufen werden.

Inhaltsverzeichnis

Parameter

str - Referenz auf I/O-Stream

Rückgabewert

str (Referenz auf den Stream nach der Manipulation).

Beispiel

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

Ausgabe:

showpos: +42 +3.14 +0
noshowpos: 42 3.14 0

Siehe auch

löscht die angegebenen ios_base-Flags
(Funktion)
setzt die angegebenen ios_base Flags
(Funktion)