How to use uppercase and nouppercase format flag to output hex number in C++

1 Answer

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

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

int main()
{
	cout << std::showbase << std::hex;
	cout << std::uppercase << 175 << endl;
	cout << std::nouppercase << 175 << endl;

	return 0;
}


/*
run:

0XAF
0xaf

*/

 



answered Apr 6, 2018 by avibootz

Related questions

1 answer 176 views
1 answer 186 views
186 views asked Apr 7, 2018 by avibootz
1 answer 153 views
153 views asked Apr 7, 2018 by avibootz
1 answer 160 views
160 views asked Apr 7, 2018 by avibootz
1 answer 218 views
...