How to print the hex value of a character in C++

1 Answer

0 votes
#include <iostream> 
 
using namespace std; 
 
int main() 
{ 
    char ch = 'a';
      
    cout << hex << (int)ch << endl;
     
    return 0; 
} 
 
 
/*
run:
 
61
 
*/

 



answered Mar 6, 2019 by avibootz

Related questions

1 answer 104 views
1 answer 191 views
1 answer 168 views
1 answer 192 views
1 answer 174 views
1 answer 184 views
2 answers 225 views
...