I don't program in C++ however the logic is still the same in any language. Here is a fairly recent coding challenge that uses a strategy that meets your requirements in your question and should point you in the right direction:
Coding challenge: convert an integer to a sentence.[
^]
** UPDATE:
Here is a C# quick solution:
static void Main(string[] args)
{
Console.Write("Input: ");
string input = Console.ReadLine();
for (int i = input.Length - 1; i >= 0; i--)
{
double digitPosition = Math.Pow(10, i);
Console.WriteLine($"{digitPosition} = {input.Substring(input.Length - i - 1, 1)}");
}
Console.ReadKey();
}
Which outputs:
Input: 4567
1000 = 4
100 = 5
10 = 6
1 = 7
Should be pretty easy to convert to C++