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)
헤더 파일에 정의됨 <ios>
(1)
std:: ios_base & noshowpos ( std:: ios_base & str ) ;
(2)

음수가 아닌 정수 출력에서 더하기 기호 '+' 표시를 활성화하거나 비활성화합니다. 입력에는 영향을 미치지 않습니다.

1) 스트림 str 에서 showpos 플래그를 활성화합니다. 마치 str. setf ( std:: ios_base :: showpos ) 를 호출하는 것처럼 동작합니다.
2) 스트림 str 에서 showpos 플래그를 비활성화합니다. 마치 str. unsetf ( std:: ios_base :: showpos ) 를 호출한 것처럼 동작합니다.

이것은 I/O 조작자이며, 다음과 같은 표현식으로 호출될 수 있습니다: out << std :: showpos std::basic_ostream 타입의 모든 out 에 대해, 또는 다음과 같은 표현식으로 호출될 수 있습니다: in >> std :: showpos std::basic_istream 타입의 모든 in 에 대해.

목차

매개변수

str - I/O 스트림에 대한 참조

반환값

str (조작 후 스트림에 대한 참조).

예제

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

출력:

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

참고 항목

지정된 ios_base 플래그를 지움
(함수)
지정된 ios_base 플래그를 설정함
(함수)