Total members 11894 |It is currently Thu Nov 21, 2024 4:57 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





I'm trying to write a program that can read in a string of data and
determine if it is a pack palindrome.




Author:
Proficient
User avatar Posts: 280
Have thanks: 1 time

check this pice of code

Code:
#include <stdio.h>

#define PALINDROME 0
#define NOT_PALINDROME 1

main()
{
        char buff[512];

        printf("Enter a string: ");
        scanf("%s", buff);

        if (palindrome(buff) == PALINDROME) {
                printf("String is palindrome\n");
        }
        else {
                printf("String is not a palindrome\n");
        }

}
int palindrome(char *ptr)
{
        int strbeg = 0, strend = 0;

        strend = strlen(ptr) - 1;
        while ( strbeg == strend || strbeg < strend) {
                if (ptr[strbeg] != ptr[strend])
                        return (NOT_PALINDROME);

                strbeg++;
                strend--;
        }
        return (PALINDROME);
}



_________________
Please recommend my post if you found it helpful


Author:
Proficient
User avatar Posts: 228
Have thanks: 0 time
Post new topic Reply to topic  [ 2 posts ] 

  Related Posts  to : Circular Queue
 Queue Header     -  
 priority queue     -  
 generic queue     -  
 queue of objects keep track of the front and rear     -  









Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com