Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. #include <cstdlib>
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. int main() {
  6.  
  7. int liczba;
  8. cout << "Podaj liczbę do konwersji" << endl;
  9. cin >> liczba;
  10.  
  11. string wynik;
  12.  
  13. while(liczba){
  14. wynik = (liczba%2?"1":"0") + wynik;
  15. liczba /= 2;
  16. }
  17. cout << "Wynik po konwersji: " << wynik << endl;
  18. system("PAUSE");
  19. return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement