标签:关系 nbsp mic ima style etc clear for erro
class Solution { public: string toHexspeak(string num) { stringstream ss; long long inter; //转16进制 string hexret; ss << num; ss >> inter; ss.clear(); ss << hex << inter; ss >> hexret; //获取转换关系 map<char,char> transform = { {‘a‘,‘A‘}, {‘b‘,‘B‘}, {‘c‘,‘C‘}, {‘d‘,‘D‘}, {‘e‘,‘E‘}, {‘f‘,‘F‘}, {‘1‘,‘I‘}, {‘0‘,‘O‘} }; for(int i = 0; i < hexret.size(); ++i){ if(transform.count(hexret[i]) == 0){ return "ERROR"; } hexret[i] = transform[hexret[i]]; } return hexret; } };
标签:关系 nbsp mic ima style etc clear for erro
原文地址:https://www.cnblogs.com/wangqiwen-jer/p/12173726.html