C++: Converting Hexadecimal to Decimal

前端 未结 7 1741
一向
一向 2020-11-30 11:49

I\'m looking for a way to convert hex(hexadecimal) to dec(decimal) easily. I found an easy way to do this like :



        
7条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-30 11:57

    Well, the C way might be something like ...

    #include 
    #include 
    
    int main()
    {
            int n;
            scanf("%d", &n);
            printf("%X", n);
    
            exit(0);
    }
    

提交回复
热议问题