Created
February 26, 2014 10:49
-
-
Save dafr32/9227457 to your computer and use it in GitHub Desktop.
Dziesiętna na dowolny system
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
char intTOchar(int i) | |
{ | |
if (i<10) | |
return i+'0'; | |
else | |
return i+'A' -10; | |
} | |
int main() | |
{ | |
int liczba,l,syst; | |
string wynik=""; | |
cout << "Podaj liczbe: "; cin >>l; | |
liczba=l; | |
cout << "Podaj system :"; cin >>syst; | |
do { | |
wynik = intTOchar(liczba%syst) + wynik; | |
liczba/=syst; | |
} while(liczba>0); | |
cout << "liczba ("<< l <<") = "<<wynik<<endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment