Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- char s, str[80];
- int t = 0, t2 = 0;
- cin >> s;
- t = (int)(s);
- char str = dec2bin(t);
- /////
- }
- int dec2bin(int num)
- {
- int bin = 0, k = 1;
- while (num)
- {
- bin += (num % 2) * k;
- k *= 10;
- num /= 2;
- }
- return bin;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement