Each 4 binary digits can be represented by one hex digit: so 7710 = 100 11012 = 4D16
What you must do depends how you will get your statements. I would just get number in string, parse it by stoi() and output it into string steam using hex manipulator:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#include <iostream>
#include <iomanip>
#include <sstream>
int main()
{
std::string temp;
std::getline(std::cin, temp);
int x = stoi(temp, 0, 2);
std::cout << std::hex << x << std::endl; //To output
std::stringstream out;
out << std::hex << x;
temp = out.str(); //Temp now has number in hex representation
std::cout << temp;
}