#include #include #include

using namespace std;

int main() { int num; cout << "Please enter a decimal number: "; cin >> num;

stringstream ss;
ss << hex << num;
string hexNum = ss.str();

cout << "The hexadecimal equivalent of " << num << " is: " << hexNum << endl;

return 0;

}

C++ 十进制转十六进制:使用 stringstream 实现

原文地址: https://www.cveoy.top/t/topic/nQbv 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录