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

Assignment Help:

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;

  }

 

 


Related Discussions:- Check whether the string entered is a palindrome or not

Change to palindrome, A palindrome is a string that reads the same from bot...

A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your task is to convert S to palindrome

Write a c++ program that calculates the area of a circle, Write a C++ progr...

Write a C++ program that calculates the area of a circle, rectangle and square using overloaded versions of a function area ().Your program should include both declarations and def

Draw a picture using line - c program, Draw a picture using line: void...

Draw a picture using line: void main(void) {     int   driver = DETECT,mode;     int   x[10],y[10];     int   x_center = 360, y_center = 180, rad = 100;     int

Inline functions, Inline functions, C++ provides inline functions to help r...

Inline functions, C++ provides inline functions to help reduce function_call overhead especially for small functions. The qualifier inline before function's return type in the f

Constants, explain about symbolic constants with examples

explain about symbolic constants with examples

Command line arguments, i want to check the command line argument is whethe...

i want to check the command line argument is whether an integer or a string

How do you access the values within an array, How do you access the values ...

How do you access the values within an array? - Arrays comprise a number of elements, which depends on the size you assigned it during variable declaration. - Every element

Assignment, Develop a C++ program that uses a while to determine the gross ...

Develop a C++ program that uses a while to determine the gross pay (in Dollars) for each of several employees. The company pays “straight-time” for the first 40 hours worked by ea

Write a c program to input numbes in table format, Write a C program to inp...

Write a C program to input 16 numbers and print them out in a table format of 4 wide by 4 deep. E.g.   4    5    5    7   8    9    10    11   12    13    14    15   16    17

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd