Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void D2B(int x);
- int main()
- {
- int x;
- while(1)
- {
- cin >> x;
- D2B(x);
- cout << endl;
- }
- return 0;
- }
- void D2B(int x) //Decimal to binary
- {
- char B[50];
- itoa(x,B,2); // every x, in array b , to base 2
- cout << B;
- }
Add Comment
Please, Sign In to add comment