Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- long long liczba1,liczba2,poczatkowa1,poczatkowa2;
- int system1,system2,wynik1,i;
- cout << "Podaj system wprowadzenia liczby" << endl;
- cin >> system1;
- cout << "Podaj system w ktorym chcesz liczbe otrzymac" << endl;
- cin >> system2;
- cout << "Podaj liczbe" << endl;
- cin >> liczba1;
- poczatkowa1=liczba1;
- liczba2=0;
- poczatkowa2=liczba2;
- i=1;
- while(liczba1>0)
- {
- liczba2=liczba2+(liczba1%10)*i;
- i=i*system1;
- liczba1=liczba1/10;
- }
- cout << "Liczba " << poczatkowa1 << " napisana w systemie " << system1 << " w systemie 10 to " << liczba2 << endl;
- i=1;
- wynik1=0;
- while(liczba2>0)
- {
- wynik1=wynik1+(liczba2%system2)*i;
- i=i*10;
- liczba2=liczba2/system2;
- }
- cout << "Liczba " << poczatkowa1 << " ktora jest napisana systemem " << system1 << " w systemie " << system2 << " to " << wynik1 << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement