Hi everyone,
av been trying to come up witha program that will tell if a string is a plindrome.This wat i did and i can't realise the error;
#include<iostream>
#include<string>
using namespace std;
int main(){
string s;
string s2;
getline(cin,s);
s2=s;
string::iterator pos;
string::iterator pos2;
bool check;check=true;
for(pos=s.begin(),pos2=s.end()-1,pos!=s.end(),pos2!=s.begin()-1,pos++;pos2--;){
if(*pos!=*pos2){
check=false;
}
}
if(check){
cout<<"This is a Palindrome\n";
}else{
cout<<"This is not a palindrome\n";
}
return 0;
}