#include <array>
#include <iomanip>
#include <iostream>
using namespace std;
void bit_swap(unsigned& n, unsigned a, unsigned b) {
const array<unsigned, 9> pos{ 0, 0, 4, 8, 12, 16, 20, 24, 28 };
const auto mask = 0xFU;
const auto first = (n >> pos[a]) & mask;
const auto second = (n >> pos[b]) & mask;
n &= ~(mask << pos[a]);
n &= ~(mask << pos[b]);
n |= (second << pos[a]);
n |= (first << pos[b]);
}
int main() {
system("chcp 1251 > nul");
cout << "Введите целое положительное число: ";
unsigned x;
cin >> x;
cout << ">>> " << "0x" << hex << uppercase << setw(8U) << setfill('0') << x << '\n';
bit_swap(x, 3, 7);
bit_swap(x, 4, 8);
cout << "<<< " << "0x" << hex << uppercase << setw(8U) << setfill('0') << x << '\n';
system("pause > nul");
}