📜  c++代码示例中的回文检查器

📅  最后修改于: 2022-03-11 14:44:53.408000             🧑  作者: Mango

代码示例2
#include
using namespace std;

int main()
{
    string s1, s2;
    cout << "Enter string: ";
    cin >> s1;

    for (int i = s1.length()-1; i >= 0; i--)
    {
        s2 += s1[i];
    }

    if (s1 == s2)
    {
        cout << "Palindrome!" << endl;
    }
    else
    {
        cout << "Not Palindrome!" << endl;
    }

    return 0;
}