Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdlib>
- #include <iostream>
- using namespace std;
- int tablica[15];
- int liczba, reszta;
- void zerowanie ()
- {
- int a;
- for (a=0; a<=15; a++)
- {
- tablica[a]=0;
- }
- }
- void wprlicz ()
- {
- do
- {
- cout<<"Wprowadz liczbe z zakresu 1-10000" <<endl;
- cin >> liczba;
- }
- while (liczba>10000);
- }
- void liczenie ()
- {
- int n;
- cout << "podaj podstawe";
- cin>>n;
- int z=0;
- do
- {
- reszta = liczba%n;
- liczba = liczba/n;
- tablica[z]=reszta;
- z=z+1;
- }
- while (liczba!=0);
- if (tablica[z]==0)
- {
- for (z=z-1; z>=0; z--)
- {
- cout<<tablica[z];
- }
- }
- else
- {
- for (z; z>=0; z--)
- {
- cout<<tablica[z];
- }
- }
- }
- int main(int argc, char *argv[])
- {
- zerowanie ();
- wprlicz ();
- liczenie ();
- system("PAUSE");
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement