Guest User

Untitled

a guest
Jun 19th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. void D2B(int x);
  4. int main()
  5. {
  6.         int x;
  7.         while(1)
  8.         {
  9.                 cin >> x;
  10.                 D2B(x);        
  11.                 cout << endl;
  12.         }
  13.     return 0;
  14. }
  15. void D2B(int x) //Decimal to binary
  16. {
  17.         char B[50];
  18.         itoa(x,B,2); // every x, in array b , to base 2
  19.         cout << B;
  20. }
Add Comment
Please, Sign In to add comment