How to use showbase and noshowbase (numerical base prefix) format flags in C++

1 Answer

0 votes
#include <iostream>
#include <iomanip> 

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

int main()
{
	int n = 65;

	cout << std::hex << std::showbase << n << endl;
	cout << std::hex << std::noshowbase << n << endl;

	return 0;
}


/*
run:

0x41
41

*/

 



answered Apr 7, 2018 by avibootz
...