Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
20 lines (18 sloc) 544 Bytes
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char const *argv[])
const string hexdigits = "0123456789ABCDEF";
cout << "Enter a series of numbers between 0 and 15" << endl;
string result; //用于保存十六进制的字符串
string::size_type n;
while (cin >> n)
if( n < hexdigits.size())
result += hexdigits[n];
std::cout << "hex result is " << result << endl;
return 0;
You can’t perform that action at this time.