+ 1

Base 16 printer

I want to print this grid in base 16.. plz help me int grid ={{1,2,5,3,10,16,1}, {10,10,10 3,7,3,3}, {1,3,5,3,9 16}}; It should be 1 2 5 3 A G 1 A A A 3 7 3 3 1 3 5 3 9 G Plz help me

4th Sep 2020, 1:22 PM
Mr database
Mr database - avatar
2 odpowiedzi
+ 3
You can use the std::hex manipulator to print values in base 16. Have a look at this link: https://en.cppreference.com/w/cpp/io/manip/hex Since it is 'sticky', i.e. the base will remain hexadecimal until you change it again, you can use it once std::cout << std::hex; and print the grid afterwards by iterating it like you usually would.
4th Sep 2020, 1:26 PM
Shadow
Shadow - avatar
+ 1
Thanks
4th Sep 2020, 1:28 PM
Mr database
Mr database - avatar