Introducing Radical.sh

Forget Code launches a powerful code generator for building API's

Palindrome program without using string function in C++

#include <iostream>
#include <conio.h>
using namespace std;

int main()
{
char inpString[100];
cout<<"Enter the String (Max 99 Characters)\t:";
cin>>inpString;

int strLength = 0;
int i,j;
for (i = 0; i < 100; i++)
{
if(inpString[i] != '\0')
strLength++;
else
break;
}

for(i = 0, j=strLength-1; i < strLength-1/2; i++,j--)
{
if(inpString[i] != inpString[j])
{
cout<<"Given String is Not Palindrome";

getch();
return 0;
}
}

cout<<"Given String is Palindrome";

getch();
return 0;
}