Hi there. Sorry, that was a very vague code explanation attempt from me. I am learning about data handling and number conversion in Object Pascal. So, the program I am attempting to make is to take a user’s input of a fixed length. Store the value and then allow them to point to a digit and change just the selected value.
For example user enters 25697 -> value gets stored in an Array (or something more suitable) -> display the array, i.e.:
index1 [2]
index2 [5]
index3 [6]
index4 [9]
index5 [7]
-> Allow the user to select what number to replace by selecting the index number. -> Then generate a new number showing the changes.
In my earlier code attempt I was trying to say that if the user inputs a 0 as the first number then display and error message. I hope this helps.
Watch closely to PascalDragon's hint:
If you need to manually process the digits (as you said in another post) you need to do so manually by using div and mod on the returned value.
When you mod an integer by 10, you get the last digit.
When you div an integer by 10, you strip out the last digit.
Likewise, you can form the original integer back by multiplying it by 10 then add the last digit from mod result.
You just need to loop this for an exact number of times depending on which digit your user wants to change.
This is a good brain training that I'm afraid more and more programmers are lacking and tend to use less resource efficient solution such as using array like what you did.