How to clear (unset) cout flag in C++

1 Answer

0 votes
#include <iostream>

using std::cout;
using std::ios;
using std::endl;


int main()
{
	cout.unsetf(ios::dec); 
	cout.setf(ios::hex);
	cout << 223 << endl;

	cout.unsetf(ios::hex); 
	cout.setf(ios::dec);
	cout << 223 << endl;

	return 0;
}



/*
run:

df
223

*/

 



answered Apr 10, 2018 by avibootz

Related questions

1 answer 205 views
1 answer 238 views
238 views asked Apr 10, 2018 by avibootz
1 answer 159 views
159 views asked Apr 8, 2018 by avibootz
...