Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <iomanip>
- //using namespace std;
- std::string hexa(int h) {
- int i=0;
- std::stringstream s;
- s<< std::hex << h;
- std::string o( s.str() );
- while (o[i]){
- o[i]>='a' ? o[i]-=' ':
- i++;}
- return o;
- }
- int main (){
- std::cout<<hexa(12)<<std::endl;
- std::cout<<hexa(29)<<std::endl;
- return 0;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement