题解 | #进制转换#
进制转换
http://www.nowcoder.com/practice/8f3df50d2b9043208c5eed283d1d4da6
#include<iostream>
#include<string>
using namespace std;
int main()
{
string s;
while(getline(cin,s))
{
cout<<stoi(s,0,16)<<endl;//stoi(字符串,起始位置,n进制),将 n 进制的字符串转化为十六进制
//将字符串 s 从 0 位置开始到末尾的 2 进制转换为十六进制.
}
return 0;
}