Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void main()
- {
- unsigned int dez = 0;
- int rest = 0, ch = 0;
- char hex[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
- ch = hex[rest];
- string buf;
- cout << "Deine Zahl: "; cin >> dez;
- while (!(dez == 0)) //Abbruch wenn Dezimal 0 is
- {
- rest = dez % 16; // Rechnung
- dez = dez / 16;
- buf.insert(buf.end(), ch);
- }
- cout << buf; // buf wird ausgegeben
- cout << "\n";
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement