Check whether the string entered is a palindrome or not, C/C++ Programming

Program is to check whether the string entered is a palindrome or not:

Program is to check whether the string entered is a palindrome or not invoke function from main

int palindrome(char *st);

 

void main()

 {

 clrscr();

 int x;

 char *st;

 int ans;

 cout<<" enter the string ";

 cin>>st;

 ans=palindrome(st);

 if (ans==0)

    cout<<" the string is palindrome ";

 else

  cout<<" the string is not a palindrome ";

 }

 

 int palindrome(char *st)

  {

  int i;

  int l=strlen(st);

  for(i=0;i

    {

    if (st[i]!=st[l-1-i])

                return 1;

    }

    return 0;

  }

 

 

Posted Date: 10/19/2012 7:56:38 AM | Location : United States







Related Discussions:- Check whether the string entered is a palindrome or not, Assignment Help, Ask Question on Check whether the string entered is a palindrome or not, Get Answer, Expert's Help, Check whether the string entered is a palindrome or not Discussions

Write discussion on Check whether the string entered is a palindrome or not
Your posts are moderated
Related Questions
how are metric numer change the number of metric

At a shop of marbles, packs of marbles are prepared. Packets are named A, B, C, D, E …….. All packets are kept in a VERTICAL SHELF in random order. Any numbers of packets with thes

C Program for FUNCTION OF COUNT THE INTEREST float si(float,float,float); void main() {           float p=0,r=0,n=0,k=0;           clrscr();           printf("E

Define the Processing of a Structure? The members of structure are typically processed individually as separate entities. So we must be able to access the individual structure

Hi I''m trying to connect to CISCO router using termios. So I decided to have two threads one for reading data and the other one for writing data. The problem is that I have to add

pls give me answer 01110-00110 in 2''s comlpiment in detail

This problem familiarizes you with using random numbers in C++. The program is to compute a good approximation of π using a simulation method called "Monte Carlo". The following fi

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b

#At a shop of marbles, packs of marbles are prepared. Packets are named A, B, C, D, E …….. All packets are kept in a VERTICAL SHELF in random order. Any numbers of packets with the