Stringstream is stream class present in C++ which is used for doing operations on a string. It can be used for formatting/parsing/converting a string to number/char etc.
Hex is an I/O manipulator that takes reference to an I/O stream as parameter and returns reference to the stream after manipulation.
Here is a quick way to convert any decimal to hexadecimal using stringstream:
If we want to change hexadecimal string back to decimal you can do it by following way:
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Program for Hexadecimal to Decimal
- stringstream in C++ and its applications
- Removing spaces from a string using Stringstream
- Find words which are greater than given length k using stringstream
- Count Hexadecimal Number
- Program to Convert Hexadecimal to Octal
- Program to convert IP address to hexadecimal
- list back() function in C++ STL
- std::string::back() in C++ with Examples
- Hexadecimal equivalents in Binary Valued Graph
- Convert Hexadecimal value String to ASCII value String
- Convert a binary number to hexadecimal number
- list::front() and list::back() in C++ STL
- deque::front() and deque::back() in C++ STL
- array::front() and array::back() in C++ STL
- queue::front() and queue::back() in C++ STL
- vector::front() and vector::back() in C++ STL
- BCD or Binary Coded Decimal
- BCD addition of given Decimal numbers
- Convert a given Decimal number to its BCD representation
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.