zoukankan      html  css  js  c++  java
  • *** checkRevStr.cpp 查看字符串是否是回文

    #include <iostream>
    #include <string.h>
    using namespace std;
    bool checkRevStr (const char * src)
    {
        if (src == NULL) return false;
        const char * end = src + strlen(src) - 1;
        while (*src++ == *end--);
        return (src<end)?(false):(true);
    }
    int main()
    {
        char a[] = "level";
        char b[] = "hanna";
        if (checkRevStr(b))
        {
            cout << "yes, it is!" << endl;
        }
        else
        {
            cout << "No, it is not!" << endl;
        }
        return 0;
    }
  • 相关阅读:
    poj1087最大流拆点
    3月15上午的函数练习
    3月15
    3月13上午
    3月13
    3月12
    break语句
    3月11
    3月10号
    3月9号
  • 原文地址:https://www.cnblogs.com/superrunner/p/10165245.html
Copyright © 2011-2022 走看看