Polidromy

[code=cpp]#include #include using namespace std; int main() { string haslo; bool palindrom; cout«“Podaj hasło:”; cin»haslo; { palindrom = true; for (int i = 0; i < haslo.length()/2; i++) if (haslo[i] != haslo[haslo.length()-1-i]) palindrom = false; if (palindrom) cout<<haslo<<" to palindrom"<<endl; else cout<<haslo<<" nie jest palindromem"<<endl; } system("PAUSE"); return 0; }[/code]

[code=cpp]#include #include using namespace std; int main() { string haslo; bool palindrom; cout«“Podaj hasło:”; cin»haslo; { palindrom = true;

    for (int i = 0; i < haslo.length()/2; i++)
        if (haslo[i] != haslo[haslo.length()-1-i])
            palindrom = false;
   
    if (palindrom)
        cout<<haslo<<" to palindrom"<<endl;
        else cout<<haslo<<" nie jest palindromem"<<endl;
}

system("PAUSE");
return 0;

}[/code]