本文介绍了查找数字的特定数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图找到任意长度的整数的 n th数字。我要将整数转换为字符串并使用索引n处的字符...
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...
char Digit = itoa(Number).at (n);
...但是我意识到 itoa 标准。有没有其他方法可以做到这一点?
...But then I realized the itoa function isn't standard. Is there any other way to do this?
推荐答案(number / intPower(10,n)) %10
只需定义函数 intPower 。
更多推荐
查找数字的特定数字
发布评论