最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
C++ 中回文数判断简单实例
时间:2022-06-25 07:50:39 编辑:袖梨 来源:一聚教程网
C++ 中回文数判断简单实例
判断一个整型数是否为“回文数”,如1221,232,5。
代码如下 | 复制代码 |
#include usingnamespacestd;
voidisHuiwen(intnumber) { intn = 0;//余数. intm = number; while(m != 0) { n = n*10 + m %10;//number的最低位变为n的最高位 m = m /10; }
if(n==number) cout <<"yes"<< endl; else cout <<"no"<< endl; }
intmain() { intnumber; while(cin >> number) isHuiwen(number); return0; } |
相关文章
- 重建生存营地兑换码是什么 重建生存营地2025最新兑换码大全 10-14
- 无限暖暖技巧之外琴弦之上任务怎么做-技巧之外琴弦之上任务攻略 10-14
- 三国群英传策定九州兑换码是什么 三国群英传策定九州2025最新兑换码大全 10-14
- 寻道大千兑换码大全 2025最新可用兑换码一览 10-14
- 绝区零真斗技能详解 10-14
- 原神千星奇域装扮获取途径 10-14