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 87 views
1 answer 181 views
1 answer 161 views
1 answer 175 views
1 answer 161 views
1 answer 171 views
2 answers 209 views
...