Advertisement
Guest User

Untitled

a guest
Jan 15th, 2020
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.54 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. string zamiana(int a,int p)
  6. {
  7.     string wynik="";
  8.     int reszta=0;
  9.     if(reszta==10)
  10.         wynik='A'+wynik;
  11.     else if(reszta==11)
  12.         wynik='B'+wynik;
  13.     else if(reszta==12)
  14.         wynik='C'+wynik;
  15.     else if(reszta==13)
  16.         wynik='D'+wynik;
  17.     else if(reszta==14)
  18.         wynik='E'+wynik;
  19.     else if(reszta==15)
  20.         wynik='F'+wynik;
  21.     else
  22.         wynik=(char) (a%p+48)+wynik;
  23.     a=a/p;
  24. }   return wynik;
  25. }
  26.  
  27. int main()
  28. {
  29.     cout<<zamiana(67,2)<<endl;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement