标签:for clu cout rom creat [] pre std bsp
// // main.cpp // ex10_5 // // Created by a007 on 17/12/2. // Copyright ? 2017年 a007. All rights reserved. // #include <iostream> using namespace std; bool isPalindrome(const string &s){ string test = ""; for (auto c : s) { test += toupper(c); //统一大写(或小写)处理 } auto begStr = begin(test); auto endStr = end(test) - 1; while (begStr < endStr) { if (*begStr != *endStr) { return false; } begStr++; endStr--; } return true; } int main(int argc, const char * argv[]) { string s; cout << "Enter a string s: "; cin >> s; if (isPalindrome(s)) { cout << s << " is a palindrome" << endl; }else{ cout << s << " is not a palindrome" << endl; } return 0; }
标签:for clu cout rom creat [] pre std bsp
原文地址:http://www.cnblogs.com/mocuishle/p/7945143.html