Ask Sawal

Discussion Forum
Notification Icon1
Write Answer Icon
Add Question Icon

How to hex in cpp?

2 Answer(s) Available
Answer # 1 #

Syntax:

Parameters: This method accepts str as a parameter which is the stream for which the format flag is affected.

Return Value: This method returns the stream str with internal format flag set.

Example 1:

Example 2:

Reference: http://www.cplusplus.com/reference/ios/hex/

[4]
Edit
Query
Report
Vijayashanti Korner
INVOICE CONTROL CLERK
Answer # 2 #
  • Firstly, we will take the string from the user.
  • Now, we will process each character one by one and convert that character to its ASCII code.
  • To convert the character to its ASCII value, we will use typecasting.
  • Now, we will use hex manipulator to convert the ASCII value to its hexadecimal version.
[2]
Edit
Query
Report
S.S Bassu
BOLTER