Advertisement
zv1ad

1 лаба

May 3rd, 2015
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #pragma hdrstop
  2. #pragma argsused
  3.  
  4. #include <tchar.h>
  5. #include <stdio.h>
  6. #include <iostream.h>
  7. #include <conio.h>
  8.  
  9. void DecToBin(int);
  10.  
  11. int z;
  12.  
  13. int main()
  14. {
  15. int n;
  16.    cout << "n = ? ";
  17.    cin >> n;
  18.    cout << "z= ?";
  19.    cin >> z;
  20.  
  21.  
  22.  
  23.    cout << n << " (desyatichnaya) = ";
  24.    DecToBin( n );
  25.    cout << " (v sisteme p<9)" << endl;
  26.    getch();
  27.    return 0;
  28.  
  29. }
  30. void DecToBin(int n)
  31. {
  32.                 if ( n >= z ) {
  33.                   DecToBin( n/z );
  34.    }
  35.    cout << n % z;
  36.  
  37.    return;
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement