Hello,
I have been trying to figure out how to cout a specific digit from an integer and I am not quite sure where to begin. I have been reading over guides for using count, rfind, strings, and they don't appear to be quite what I am looking for, or I am not understanding them correctly on how to implement the procedure. What I am attempting to do is enter a variable:
Code:cout << "Enter a value for A. The value must be 0 to 999999999: "; // This is the primary value. cin >> A; cin.ignore(); cout << "Enter a second value for A. This value must be 1 to 9: "; // This value is used to call the specific digit in the integer. cin >> D; cin.ignore();
and get it to read from left to right the specific digit placement.
Ex: value: 96538413
Digit 3 is 5
Digit 4 is 3
It is mainly the concept behind this little piece of code that I have not been able to grasp. I would greatly appreciate any type of help, or being pointed in the right direction.