You must implement a counter from the number written in the String. Those. at each iteration of the cycle, the string number should be increased by 1. That is, was "123", after the next iteration should be "124", etc.
I have a problem with discharges. Here I have such a piece of code increases only from 0 to 9, but I don’t know how to increase and add a new digit (tens, hundreds, etc.).
if(str[(str.size()-1]-'0'< 9) str[(str.size()-1]+=1;