#include <iostream>
#include <stdio.h>
#include <locale.h>
typedef unsigned short ushort;
using namespace std;
int main()
{
setlocale(LC_ALL, "Russian");
ushort num, upp = 0;
cout << "Введите число в 16-ичной системе: ";
cin >> hex >> num;
cin.get();
ushort low = num & 0xFF;
for (int i = 0; i < 8; i++)
{
upp = upp << 1;
upp |= (low >> i) & 1;
}
ushort res = low + 0x100 * upp;
cout << "Число преобразовано в: " << hex << res << endl;
return 0;
}