Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <bitset>
- using namespace std;
- int main(void)
- {
- int a;
- char b;
- int operazione;
- do {
- cout << "Inserire un numero: ";
- cin >> a;
- cout << "\n1) Conversione binario \n2)conversione ottale \n3)conversione esadecimale \n4)Conversione decimale\nQuale conversione devo fare? ";
- cin >> operazione;
- switch (operazione){
- case 1:
- cout <<"\n\nValore binario: "<< bitset<32>(a)<< endl;
- break;
- case 2:
- cout << "Valore ottale: " << oct << a << endl;
- break;
- case 3:
- cout << "Valore esadecimale: " << hex << a << endl;
- break;
- case 4:
- cout << "Valore decimale: " << dec << a << endl;
- break;
- default:
- cout <<"ERRORE";
- break;
- }
- cout << "\nVuoi continuare? (S/N) ";
- cin >> b;
- }while (b != 'N');
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement