WRITE A C++ PROGRAM TO CONVERT HEX TO ASCII STRING
#include <iostream> #include <fstream> #include <string> #include <sstream> using namespace std; int main () { string Str; cout << "Enter A Hex Value eg.(0x4D) To Conver Into ASCII Char=" ; cin>>Str; cout << endl; std::istringstream iss (Str); iss.flags(std::ios::hex); int i; iss >> i; std::cout <<"OUTPUT=" << (char)i << std::endl; return 0; }
OUTPUT:
Enter A Hex Value (0x4D) To Conver Into Hex=0x6D
OUTPUT=m
No comments:
Post a Comment