C++ Integer [?]

c++

Solution

You can use the following formula (pseudo-code) :

currDigit = (absolute(value) / 10^index) modulo 10; // (where ^ is power-of)

Problem

In Java, strings have a `charAt()` function. In C++, that function is simply `stringname[INDEX]` However, what if I wanted to use a particular number at a certain index of an integer? E.g. ``` int value = 9123; ``` Let's say I wanted to work with the index 0, which is just the 9. Is there a way to use index at's with integers?

Original source

Related problems