10 How to turn to 16 credits

Xiaobian to share the 10-based number of how to turn to 16 credits, I hope everyone will read the big gains after this article, let us go to discuss together!

Enter a 10-grade number, output the number of 16-based number of items corresponding to the number of items

Idea

First use 10 The number is 16, and the remainder is the number that cannot be in. It is written in the lowest position. How many people have a business meaning? If the merchant is more than or equal to 16, it means that it can be followed, then the merchant is connected to 16, The remainder is written in the second place … with this, until it is not possible

code

  #inClude  #nclude  Using Namespace STD; string m = "0123456789abcdef"; int main () {int N; cin >> n; string ANS = ""; while (true) {if (n < 16)
       {
           ans = m[n] + ans;            break;
       }        int w = n % 16;
       ans = m[w] + ans;
       n = n / 16;
   }    cout << ans;
} 

After reading it This article, I believe that you have a certain understanding of the number of 10 credits to 16, I want to know more related knowledge. Welcome to Tumi Yun Industry Information Channel, thank you!

© Copyright Notice
THE END
Just support it if you like
like0
share
comment Grab the couch

Please log in to comment