其实无需进行数据的转化,在读取的时候,将输入切换到16进制,输出切换到10进制,同样可以解决进制转化问题

#include<iostream>
#include<string>
#include<math.h>
#include<stdio.h>
using namespace std;
int main(){
    int temp;
    cin>>hex;
    while(cin>>temp){
        cout<<dec;
        cout<<temp<<endl;
    };
          return 0;
}