Total members 10249 | Gratitudes |It is currently Thu May 17, 2012 7:50 am Login / Join Codemiles


All times are UTC [ DST ]




Post new topic Reply to topic  Quick reply  [ 2 posts ] 
Author Question
 Question subject: Circular Queue
PostPosted: Fri Nov 07, 2008 5:29 pm 
Offline
Proficient
User avatar

Joined: Sun Oct 19, 2008 3:47 pm
Posts: 281
Has thanked: 0 time
Have thanks: 1 time

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


TOP
 Profile Send private message  
Reply with quote  
 Question subject: Re: Circular Queue
PostPosted: Fri Nov 07, 2008 5:32 pm 
Offline
Proficient
User avatar

Joined: Sun Oct 19, 2008 3:53 pm
Posts: 229
Has thanked: 0 time
Have thanks: 0 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);
}



TOP
 Profile Send private message  
Reply with quote  
Post new topic Reply to topic Quick reply  [ 2 posts ] 
Quick reply


  

 Similar topics
 generic queue
 priority queue
 Queue Header

All times are UTC [ DST ]


Users browsing similar posts

Users browsing this forum: No registered users and 1 guest



Jump to:  
Previous Question | Next Question 




Home
General Talks
Finished Projects
Code Library
Games
Tutorials

Java
C/C++
C-sharp
php
Script
JSP/Servlets
Ajax
ASP/ASP.net
Google SEO
Database
Communications
Phpbb3 styles
Photoshop tutorials
Flash tutorials
Find a job






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team