【发布时间】:2019-10-17 09:53:57
【问题描述】:
我的代码将一个整数解析为多个部分并将它们写入一个数组,但现在我想将该数组收集回一个整数。
我将修改数组中的数据,所以我需要在更改后收集所有内容。
int a = 123456789;
std::string stringInt = std::to_string(a);
std::vector<int> numbers;
numbers.reserve(stringInt.length());
for (const auto& chr : stringInt)
{
// ...
numbers.push_back(chr - '0');
cout << chr << "\n" << endl;
}
【问题讨论】:
-
你的问题是......?