Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <cstdlib>
- #include <string>
- #include <fstream>
- using namespace std;
- int main()
- {
- cout<<"1 - 10->16 , 2- 16->10"<<endl;
- int a,liczba,c;
- string table[100];
- cin>>a;
- cout<<"podaj liczbe"<<endl;
- switch(a)
- {
- case 1:
- cin>>liczba;
- cout<<endl<<"wynik to: "<<endl;
- while(liczba>15)
- {
- c = liczba%16;
- if(c == 0)
- cout<<"0";
- if(c == 1)
- cout<<"1";
- if(c == 2)
- cout<<"2";
- if(c == 3)
- cout<<"3";
- if(c == 4)
- cout<<"4";
- if(c == 5)
- cout<<"5";
- if(c == 6)
- cout<<"6";
- if(c == 7)
- cout<<"7";
- if(c == 8)
- cout<<"8";
- if(c == 9)
- cout<<"9";
- if(c == 10)
- cout<<"a";
- if(c == 11)
- cout<<"b";
- if(c == 12)
- cout<<"c";
- if(c == 13)
- cout<<"d";
- if(c == 14)
- cout<<"e";
- if(c == 15)
- cout<<"f";
- cout<<endl;
- liczba = (liczba-c)/16;
- }
- c = liczba;
- if(c == 0)
- cout<<"0";
- if(c == 1)
- cout<<"1";
- if(c == 2)
- cout<<"2";
- if(c == 3)
- cout<<"3";
- if(c == 4)
- cout<<"4";
- if(c == 5)
- cout<<"5";
- if(c == 6)
- cout<<"6";
- if(c == 7)
- cout<<"7";
- if(c == 8)
- cout<<"8";
- if(c == 9)
- cout<<"9";
- if(c == 10)
- cout<<"a";
- if(c == 11)
- cout<<"b";
- if(c == 12)
- cout<<"c";
- if(c == 13)
- cout<<"d";
- if(c == 14)
- cout<<"e";
- if(c == 15)
- cout<<"f";
- cout<<endl;
- break;
- case 2:
- //porzucilem
- break;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement