C
Chris Stankevitz
char c = 0xFF;
Q1: How do I use cout to print the variable c so that it appears at
stdout as "FF"?
A1:
#include <iomanip>
#include <iostream>
std::cout << std::hex << std::setfill('0') << std::setw(2) <<
std::uppercase << (static_cast<int>(c) & 0xFF);
Q2: Surely you can't be serious.
A2: I am serious. And don't call me Shirley.
Q1: How do I use cout to print the variable c so that it appears at
stdout as "FF"?
A1:
#include <iomanip>
#include <iostream>
std::cout << std::hex << std::setfill('0') << std::setw(2) <<
std::uppercase << (static_cast<int>(c) & 0xFF);
Q2: Surely you can't be serious.
A2: I am serious. And don't call me Shirley.