Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <bitset>
- using namespace std;
- int main()
- {
- setlocale(LC_ALL, "RU");
- int n;
- cout << "Введите число: ";
- cin >> n;
- bitset<8> n2 = n; // Для двоичной системы
- //showbase показыает тип системы
- cout << "\nВ двоичной системе: "<< showbase << n2 << '\n'; // 2
- cout << "В восмеричной системе: " << oct << n << '\n'; // 8
- cout << "В десятичной системе: " << dec << n << '\n'; // 10
- cout << "В шестнадцатиричной системе: " << hex << n << '\n'; // 16
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement