查找数字的特定数字

编程入门 行业动态 更新时间:2024-10-26 09:20:37
本文介绍了查找数字的特定数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我试图找到任意长度的整数的 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 。

更多推荐

查找数字的特定数字

本文发布于:2023-10-23 19:44:57,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1521830.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数字

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!