Loading...
Searching...
No Matches
decimal_to_hexadecimal.cpp
Go to the documentation of this file. 12 intvalueToConvert = 0;
// Holds user input 13 inthexArray[8];
// Contains hex values backwards 15 charHexValues[] =
"0123456789ABCDEF";
17std::cout <<
"Enter a Decimal Value" 18<< std::endl;
// Displays request to stdout 20valueToConvert;
// Stores value into valueToConvert via user input 22 while(valueToConvert > 15) {
// Dec to Hex Algorithm 23hexArray[i++] = valueToConvert % 16;
// Gets remainder 25 // valueToConvert >>= 4; // This will divide by 2^4=16 and is faster 27hexArray[i] = valueToConvert;
// Gets last value 29std::cout <<
"Hex Value: ";
30 while(i >= 0) std::cout << HexValues[hexArray[i--]];
32std::cout << std::endl;
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4