iomanip - STL C++

setiosflags()

Declaration

(unspecified) setiosflags(ios_base::fmtflags qFlags);

Description

This is the setiosflags() function for output stream manipulation. The argument qFlags sets flags that are used for formatting output.

Header Include

#include <iomanip>

Example

#include <iostream>
#include <iomanip>

int main() {
	using namespace std;

	double dNumber = 9287.343535;
	// Output the value with default settings
	cout << "Default: " << dNumber << endl;

	// Output the value with in scientific notation
	cout << setiosflags(ios_base::scientific);
	cout << "Scientific notation: " << dNumber << endl;

	// Keep the window open
	cin.get();
	return 0;
}

Output

setiosflags() Output
 

© 2007–2024 XoaX.net LLC. All rights reserved.