Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int cyfry(int);
- int main()
- {
- int a,p,t=0,q,w,e=0,wynik;
- int tab[100];
- int druga[100];
- cout << "Podaj liczbe dziesietna " << endl;
- cin>>a;
- cout<<" Podaj system zamiany "<<endl;
- cin>>p;
- while(a!=0){
- tab[t]=a%p;
- a=a/p;
- tab[t++];
- }
- for(int k=t-1;k>=0;k--){
- cout<<tab[k];
- }
- // drugi program ----------------------------------------------------------
- cout << "Podaj system liczbowy " << endl;
- cin>>q;
- cout<<" Podaj liczbe w tym systemie"<<endl;
- cin>>w;
- cout<<cyfry(w);
- for(int j=cyfry(w);j>0;j--){
- druga[j-e]=w/10;
- e++;
- wynik=q*druga[j];
- druga[j-e]=w%10;
- e++;
- }
- return 0;
- }
- int cyfry(int liczba)
- {
- int b=1;
- while(liczba=liczba/10)b++;
- return b;
- }
Advertisement
Add Comment
Please, Sign In to add comment