Finding a Specific Digit of a Number

后端 未结 9 1938
深忆病人
深忆病人 2020-12-16 23:32

I\'m trying to find the nth digit of an integer of an arbitrary length. I was going to convert the integer to a string and use the character at index n...

9条回答
  •  情书的邮戳
    2020-12-17 00:21

    const char digit = '0' + number.at(n);
    

    Assuming number.at(n) returns a decimal digit in the range 0...9, that is.

提交回复
热议问题