Advertisement
Guest User

palec nie umi

a guest
Mar 26th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int liczba,mnoznik=1,liczbaDwa=0;
  5. //int * tablica=new int[1],ileWTab=1;
  6. int main()
  7. {
  8. cout << "Podaj liczbe - ";
  9. cin >> liczba;
  10. //Po 1023 - int sie konczy
  11. /*
  12. while(liczba){
  13. liczbaDwa+=(liczba%2)*mnoznik;
  14. mnoznik*=10;
  15. liczba/=2;
  16. }
  17. cout << liczbaDwa;
  18. */
  19.  
  20. //Od tylu wypisuje, po 2147483647 psuje sie
  21. /*
  22. while(liczba){
  23. cout << liczba%2;
  24. liczba/=2;
  25. }
  26. */
  27.  
  28. //Z tablica dynamiczna
  29. //Choc nie wiem jak dokladnie dziala
  30. /*
  31. while(liczba){
  32. tablica[ileWTab-1]=liczba%2;
  33. liczba/=2;
  34. ileWTab++;
  35. }
  36. for(ileWTab;ileWTab>1;ileWTab--)
  37. cout << tablica[ileWTab-2] << " ";
  38.  
  39. delete [] tablica;
  40. */
  41. return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement