判断字符串是否为”回文“
来源:互联网 发布:glibc malloc源码 编辑:程序博客网 时间:2024/05/02 01:31
<span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);">判断str所指字符串是否是”回文“(即顺度和逆读是相同的字符)</span>
使用C#编写结果如下:
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace ConsoleApplication2._2{ class Program { static void Main(string[] args) { String str = ""; Console.WriteLine("请输入一个字符串: "); str = Console.ReadLine(); if (judge(str)) { Console.WriteLine("这是一个回文"); } else Console.WriteLine("这不是回文"); Console.ReadKey(); } <span style="color:#ff0000;"> static bool judge(String str) { bool flag = true; for (int i = 0; i < str.Length; i++) { if (str[i]!=str[str.Length-i-1]) { flag = false; } } return flag; }</span> }}
0 0
- 判断字符串是否为回文
- 判断字符串是否为回文
- 判断字符串是否为”回文“
- 判断字符串是否为回文
- 判断字符串是否为回文
- 判断字符串是否为回文
- 判断字符串是否为回文
- 判断是否为回文字符串
- 判断字符串是否为回文
- 判断字符串是否为回文字符串
- 判断字符串是否为回文字符串
- 判断字符串是否为回文字符串
- 3-2 判断字符串是否为回文
- java判断字符串是否为回文?
- 判断一个字符串是否为回文
- 判断一个字符串是否为回文
- 判断一个字符串是否为回文
- 判断字符串是否为回文 python实现
- java设计模式——结构型之桥接模式
- css+div绝对居中
- 系统吞吐量、TPS(QPS)、用户并发量、性能测试概念和公式
- hadoop系列文档4-配置Yarn高可用HA
- 关于对AndroidManifest.xml的理解
- 判断字符串是否为”回文“
- QML对键盘事件的处理
- IOS图片转base64字符串和字符串转回图片
- jqurey_servlet_json流程
- Java InputStream&FileInputStream 源代码分析
- 受限玻尔兹曼机——简单证明
- CNN卷积神经网络
- The Future of Real-Time SLAM and "Deep Learning vs SLAM" 深度学习与slam
- POJ2386水洼问题 优先深度搜索