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 172 views
1 answer 178 views
178 views asked Apr 7, 2018 by avibootz
1 answer 146 views
146 views asked Apr 7, 2018 by avibootz
1 answer 153 views
153 views asked Apr 7, 2018 by avibootz
1 answer 211 views
...