📅  最后修改于: 2022-03-11 14:44:56.244000             🧑  作者: Mango
#include
#include
using namespace std;
vector integerToArray(int x)
{
vector resultArray;
while (true)
{
resultArray.insert(resultArray.begin(), x%10);
x /= 10;
if(x == 0)
return resultArray;
}
}
int main()
{
vector temp = integerToArray(1234567);
for (auto const &element : temp)
cout << element << " " ;
return 0;
}
//outputs 1 2 3 4 5 6 7