ios manipulators boolalpha() function in C++ Last Updated : 12 Jul, 2025 Comments Improve Suggest changes 4 Likes Like Report The boolalpha() method of stream manipulators in C++ is used to set the boolalpha format flag for the specified str stream. Syntax: ios_base& boolalpha (ios_base& str) Parameters: This method accepts str as a a parameter which is the stream for which the format flag is affected. Return Value: This method returns the stream str with boolalpha format flag set. Example 1: CPP // C++ code to demonstrate // the working of boolalpha() function #include <iostream> using namespace std; int main() { // Initializing the boolean flag bool flag = true; // Using boolalpha() cout << "boolalpha flag: " << boolalpha << flag << endl; return 0; } Output: boolalpha flag: true Example 2: CPP // C++ code to demonstrate // the working of boolalpha() function #include <iostream> using namespace std; int main() { // Initializing the boolean flag bool flag = false; // Using boolalpha() cout << "boolalpha flag: " << boolalpha << flag << endl; return 0; } Output: boolalpha flag: false Reference: https://cplusplus.com/reference/ios/boolalpha/ Comment G guptayashgupta53 Follow 4 Improve G guptayashgupta53 Follow 4 Improve Article Tags : C++ cpp-ios cpp-manipulators Explore C++ BasicsIntroduction to C++3 min readData Types in C++6 min readVariables in C++4 min readOperators in C++9 min readBasic Input / Output in C++3 min readControl flow statements in Programming15+ min readLoops in C++7 min readFunctions in C++8 min readArrays in C++8 min readCore ConceptsPointers and References in C++5 min readnew and delete Operators in C++ For Dynamic Memory5 min readTemplates in C++8 min readStructures, Unions and Enumerations in C++3 min readException Handling in C++12 min readFile Handling in C++8 min readMultithreading in C++8 min readNamespace in C++5 min readOOP in C++Object Oriented Programming in C++8 min readInheritance in C++6 min readPolymorphism in C++5 min readEncapsulation in C++3 min readAbstraction in C++4 min readStandard Template Library(STL)Standard Template Library (STL) in C++3 min readContainers in C++ STL2 min readIterators in C++ STL10 min readC++ STL Algorithm Library3 min readPractice & ProblemsC++ Interview Questions and Answers1 min readC++ Programming Examples4 min read Like