阅读量:158
在C++中,可以使用std::stoll函数将大数字符串转换为长长整型(long long int)。示例如下:
#include
#include
int main() {
std::string bigNumStr = "12345678901234567890";
long long int bigNum = std::stoll(bigNumStr);
std::cout << "The converted big number is: " << bigNum class="hljs-keyword">return 0;
}
在上面的示例中,首先将大数字符串"12345678901234567890"赋值给bigNumStr变量,然后使用std::stoll函数将该字符串转换为长长整型,最后输出转换后的大数。