Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void dec_to_bin(int liczba, int system)
- {
- int i=0,tab[31];
- while(liczba)
- {
- tab[i++]=liczba%system;
- liczba/=system;
- }
- for(int j=i-1; j>=0; j--)
- {
- if(tab[j] > 9)
- cout << static_cast<char>(tab[j] + 55);
- else
- cout << tab[j];
- }
- }
- int main()
- {
- dec_to_bin(198745, 2);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment