How to print a hexadecimal value in uppercase?

4

I made a program in C ++ that reads a number and prints it in hexadecimal, follow the code below.

#include <iostream>
using namespace std;

int main(void) {

    int n;  
    cin>>n; 
    cout<<hex<<n<<endl; 

    return 0;
}

But it prints everything in tiny and I would like it printed in buttercup, how can I do that?

    
asked by anonymous 30.07.2018 / 17:39

1 answer

8

Only user uppercase :

#include <iostream>
using namespace std;

int main(void) {
    int n;  
    cin >> n; 
    cout << uppercase << hex << n << endl; 
}

See running on ideone . And at Coding Ground . Also I placed GitHub for future reference .

Documentation .

    
30.07.2018 / 17:57