- 字符串转十进制 stoi
#include <stdlib.h>
string a = "123";
int num = atoi(a.c_str());
long long number = atoll("9223372036854775807");
- 十进制转二进制
#include<bitset>
int a = 10;
bitset<8> a1(a);
- 数字转字符串
int a = 123;
string a1 = to_string(a);
bitset<8> a2(a);
string a3 = a2.to_string();
参考:https://blog.csdn.net/weixin_30502965/article/details/102374637