so I’m trying to write a program that would take an input character between 0 and 127 and then output a string of numbers in the following form:
- If I input a 0, the output should be a 0
- If I input a 5, the output should be 012345
- If I input a 9, the output should be 0123456789
- If I input a 14, the output should be 012345678901234
- If I input a 27, the output should be 0123456789012345678901234567
So, I’m looking for increments of 10 characters from 0 to 9 at most and then repeat the sequence until the last number is reached. So in 27, there’s actually 28 characters output due to the first 0, but the last one is still a 7.
I know I want to use for loops, but I’m having a bit of a trouble figuring out how to make this happen. I can probably use the the ASCII 48 through 57 for the output, but my problem is how I make the input work… should I static cast it to an integer and then work with that? I’m kind of hitting a wall here.
Try the following: