Hexa

this code i'm working for is kinda.. incomplete.. kinda confused.
not sure if this code is correct but it is running though. just want to make sure.

#include"stdafx.h"
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
int main()
{
string input;
cout << "Enter a decimal number:";
cin >> input;
cout << "\n";
stringstream s;
s << hex << input;
int x;
s >> x;
cout << "Hexadecimal number = " << x << "\n";
system("pause>0");
return 0;
}
Last edited on
1
2
3
4
    int input;
    cout << "Enter a decimal number:";
    cin >> input;
    cout << "\nHexadecimal number = " << hex << input << "\n";
Topic archived. No new replies allowed.