DESCRIPTION:
ios_base& boolalpha (ios_base& str);
bool
values are inserted/extracted by their textual representation: either true
or false
, instead of integral values.ios_base& noboolalpha (ios_base& str);
bool
values are insterted/extracted as integral values (0
and 1
) instead of their textual representations: true and false.Parameters:
Stream object whose format flag is affected.
Because this function is a manipulator, it is designed to be used alone with no arguments in conjunction with the insertion (<<
) and extraction (>>
) operations on streams (see example below).
Return Value:
Return the resultant string.
Program 1:
#include <iostream>
// std::cout, std::boolalpha, std::noboolalpha int main () {
bool b = true;
std::cout << std::boolalpha << b << endl;
std::cout << std::noboolalpha << b << endl;
return 0; }
Output:
true 1Program 2:
#include <iostream>
// std::cout, std::boolalpha, std::noboolalpha int main () {
bool b = false;
std::cout << std::noboolalpha << b << endl;
return 0; }
Output:
0
Name | Views | Likes |
---|---|---|
C++ std::ios_base::pword | 236 | 0 |
C++ std::ios::exceptions | 242 | 0 |
C++ ios | 210 | 0 |
C++ std::stringbuf::seekoff | 219 | 0 |
C++ IOS :: eof() function | 523 | 0 |
C++ ios :: nounitbuf | 184 | 0 |
C++ std::ios_base::register_callback | 202 | 0 |
C++ std::ios_base::iword | 196 | 0 |
C++ ios::nouppercase | 215 | 1 |
C++ ios::internal | 288 | 0 |
C++ ios::hexfloat | 210 | 0 |
C++ ios_base :: oct,dec,hex | 328 | 0 |
C++ ios :: boolalpha | 359 | 0 |
C++ std::ios_base::sync_with_stdio | 217 | 0 |
C++ std::ios_base::fmtflags | 222 | 0 |
C++ std::resetiosflags | 319 | 0 |
C++ ios :: skipws | 275 | 0 |
C++ std::basic_istringstream::rdbuf | 208 | 0 |
C++ fill( ) function | 274 | 0 |
C++ std::stringbuf::pbackfail | 222 | 0 |
C++ std::stringbuf::overflow | 228 | 0 |
C++ std::ios::tie | 375 | 0 |
C++ ios ::io_errc | 195 | 0 |
C++ std::setiosflags | 235 | 0 |
C++ std::ios_base::setf | 215 | 0 |
Comments