Gdy debuguje program to wyskakuje mi ostrzeżenie "warning: comparison of integer expressions of different signedness: 'int' and 'std::basic_string<char>::size_type' {aka 'unsigned int'} [-Wsign-compare]" w linijce z pętlą for. Próbowałem usunąć dzielenie przez 2, bo myślałem że to przez zmiane x.length z int na float jednak błąd dalej występuje. Nie przejmował bym się tym, ale mam wrażenie że jest to powód błędnego działania programu tzn. kiedy wpiszę z klawiatury wyraz "ala kot" to pokazuje mi że wyrażenie to palindrom natomiast gdy przypiszę string x="ala kot" to pokazuje mi poprawnie.
#include <iostream>
#include <string>
using namespace std;
int main() {
bool palindrom = true;
string x;
cin>>x;
for (int i = 0; i < x.length() / 2; i++)
if (x[i] != x[x.length() - 1 - i])
palindrom = false;
if (palindrom)
cout << "jest" << endl;
else
cout << "nie jest" << endl;
return 0;
}