#include <iostream>
#include <map>
#include <string>
#include <math.h>
using namespace std;
int main()
{
cin.tie(0),cin.sync_with_stdio(0);
map<char , int> m;
m[0] = 0;
m[1] = 1;
m[2] = 2;
m[3] = 3;
m[4] = 4;
m[5] = 5;
m[6] = 6;
m[7] = 7;
m[8] = 8;
m[9] = 9;
m['A'] = 10;
m['B'] = 11;
m['C'] = 12;
m['D'] = 13;
m['E'] = 14;
m['F'] = 15;
cout<<"十六進位表示法 相對應的十進位表示法\n";
for(int i = 0 ; i < 2 ; i++){
int count = 0;
string s;
cin >> s;
count += (m[s[1]] * pow(16 , 0) + m[s[0]] * pow(16 , 1));
cout <<" "<< s <<" "<< count<<"\n";
}
return 0;
}
m[0] = 0; m[1] = 1; m[2] = 2; m[3] = 3; m[4] = 4; m[5] = 5; m[6] = 6; m[7] = 7; m[8] = 8; m[9] = 9;
改成
m['0'] = 0; m['1'] = 1; m['2'] = 2; m['3'] = 3; m['4'] = 4; m['5'] = 5; m['6'] = 6; m['7'] = 7; m['8'] = 8; m['9'] = 9;