cpp progrom to check entered string is pallindrome or not:
solution:
#include <iostream>
#include <string.h>
using namespace std;
int main()
{
string str;
cout<<"enter the string to check it is pallindrome or not:";
cin>>str;
int flag=0;
int l =str.size();
int i;
for(i=0;i<l;i++)
{
if(str[i]!=str[l-i-1])
flag =1;
}
if(flag==0)
{
cout<<"string is pallindrome";
}
else
{
cout<<"string is not pallindrome";
}
}
0 comments: