palindrome « Development « C Q&A

Home
C Q&A
1.assembly
2.buffer
3.Card
4.Cast
5.compile
6.console
7.const
8.constructor
9.database
10.Date
11.Debug
12.Design
13.Development
14.DLL
15.encrypt
16.enum
17.eof
18.Event
19.fork
20.Format
21.gcc
22.gdb
23.graph
24.graphics
25.gui
26.Holiday Event
27.image
28.IP
29.iterator
30.macro
31.makefile
32.malloc
33.Menu
34.mysql
35.network
36.openssl
37.operator
38.password
39.pipe
40.preprocessor
41.printf
42.pthread
43.Regular expression
44.scanf
45.semaphore
46.SerialPort
47.server
48.Socket
49.sql
50.SQLserver
51.sscanf
52.std
53.stdin
54.stdout
55.stl
56.strcmp
57.stream
58.switch
59.Template
60.thread
61.timer
62.unix
63.video
64.Virtual
65.visualstudio
66.winapi
67.windows
68.xml
C Q&A » Development » palindrome 

1. How do I detect a palindrome in C?    stackoverflow.com

I've been working through potential interview questions and one of them was to write a function in C to detect whether a given string was a palindrome or not. I've gotten a ...

2. after half of the program it turns like a palindrome    stackoverflow.com

i made the strrev function myself.while compling it says that the code in the func xstrrev() has no effect.i would also like to know that while making a copy of the ...

3. palindrome or reverse in c    stackoverflow.com

how to reverse the input number and get the output

4. Palindrome - removing the goto    stackoverflow.com

Good day! Our teacher required us to determine if a word or a series of number is a palindrome or not using stacks. I already finished doing that. But I want to ...

5. Find palindrome in a range    stackoverflow.com

I wrote a program for checking whether a number is palindrome or not. I want to check between a range of numbers.

while (i!=0){
    dig = i % 10;
 ...

7. Palindrome code    bytes.com

It's certainly a different method than I would take, but it appears to work as you wanted - except if the string actually is a palindrome. You are telling it to return palin(strUserInput) in the case that the last and first characters are equal, but what if the first and last characters are equal, yet index is past the recursiveCallNo variable? ...

8. Largest Palindrome    bytes.com

HI Everybody, I 've to submit a program on c.Can any one help me plz.........The problem is like this:: Write a program which computes the largest palindrome substring of a string. Input: The input is the string whose largest palindrome substring should be found. Output: The output displays the largest palindrome substring. Sample Input: Enter the string: Habitat Sample Output: The ...

9. World Longest Palindrome    bytes.com

Amar Prakash Tripaithi wrote:[color=blue] > Dan Hoey, who had recently graduated, wrote a C program to look for and > construct the following beauty: >[/color] While I'm sure that those who have never heard of it will enjoy it: - just because the program was written in C doesn't make it relevant to this newsgroup; - the palindrome quoted was ...

10. palindrome    cboard.cprogramming.com

1 #include 2 #include 3 4 int isPalindrome1(const char *str); 5 6 int main ( ) 7 { 8 char str [40]; 9 int result; 10 scanf("%s",str); 11 12 result=isPalindrome1(&str); 13 printf("%d",result); 14 15 return 0; 16 } 17 18 int isPalindrome1 (const char *str) 19 { 20 char temp1 [40]; 21 char temp2 [40]; 22 int i=0; 23 ...

11. Palindrome Program Help!    cboard.cprogramming.com

Code: #include #include #define MAX 50 #define Null '\0' int getStringF(char [],int, FILE *); main() { int b,e,numChar,leng,eof; float comp; char pal[MAX+1], rpal[MAX+1],temp; FILE *payInFile, *payOutFile; payInFile = fopen("sample.txt","r"); payOutFile = fopen("sampout.txt","w"); fprintf(payOutFile,"Palindrome Program Fall 2011 by Bradley Lantz\n"); fprintf(payOutFile,"Project #6 Due 12/9/11\n\n"); fprintf(payOutFile,"Palindrome? Input String\n"); numChar = getStringF(pal,MAX,payInFile); //printf here prints 1st string leng = numChar; for(b=0;b

12. Display palindrome between limits    cboard.cprogramming.com

13. Prime palindrome    cboard.cprogramming.com

Here is my situation. I have seen different snippets of C code but have never really learned to program in it. I have a piece of code that I need to analyze, then modify to produce a certain output. I am hoping that someone here can point me in the direction I need to go... I am totally lost with this. ...

14. C Palindrome problem    cboard.cprogramming.com

15. Palindrome problem. I would appreciate some help. I know it is simple.    cboard.cprogramming.com

#include int main () { int i, lim, c, check = 1; char word[80]; printf ("Enter String "); for (i = 0; i < 80 && ((word[i] = getchar()) != '\n'); i++); lim = i - 1; c = lim / 2; for (i = 0; i <= 0; i++, lim--); if (word[i] != word[lim]) { check == 0; break; ...

16. Errors in Palindrome Finder    cboard.cprogramming.com

Code: #include #include #include void input(int *numberPointerOne); int test(int *numberPointerTwo); int *reverse(int*orig, unsigned short int b); int main (int argc, const char * argv[]) { int number[1000000]; int returned = 0; int lengthTwo; input(number); while(returned = 0){ returned = test(number); lengthTwo = strlen(number); reverse(number, lengthTwo); } printf("%d", returned); return 0; } void input(int *numberPointer){ printf("enter positive integer:\t"); scanf("%d", ...

17. Palindrome Problems    cboard.cprogramming.com

Hello, Im hoping someone can help me. Im trying to write a program to determine if a word or phrase is palindrome or not, the same letters forward as backwards (bob, level, madam im adam). No matter what my keyboard input is, it always sets my "palindrome" flag to "1". I even added lines to verify my array was being read ...

18. Improvements for Palindrome    cboard.cprogramming.com

Objective: Create a simple Palindrome checker program. The program should allow the user to enter a string and check whether the given string is a palindrome or not. My programming level is quite insubstantial so need some criticism. Code: #include int main() { char text[100]; int i; int fail=0; int counter=0; printf("Enter something to check if it is a palindrome:"); ...

19. Palindrome, problem with isalpha    cboard.cprogramming.com

20. the palindrome    cboard.cprogramming.com

/* this program from a master's blog but i don't know what dose it work,hope that somebody will explain this working detailedly(may be related to the palindrome ). this's about descriptions to be solved quesion: Catcher to be an agent of MCA country,he have been found any symmetrical code that enemy states used to comunicate with,such as: ABBA,ABA,A,123321 . but they ...

21. Palindrome in C    cboard.cprogramming.com

int isPalindromeString(const char *s) { // This function should return 1 if the string is a palindrome, else 0 } int isPalindromeInt(int n) { // This function should return 1 if the integer (or it's absolute value) is a palindrome, else 0 // Note that this function should call the isPalindromeString function. It just need to transform the int into a ...

22. palindrome programs    cboard.cprogramming.com

23. Is it a Palindrome?    cboard.cprogramming.com

Code: #include #include #define MAX 50 int palindrome(char[]); int main() { char str[MAX]; printf("Enter a string : "); scanf("%s",str); if(palindrome(str)==1) { printf("\nThe string is palindrome.\n"); } else { printf("\nThe string is not palindrome.\n"); } return 0; } int palindrome(char str[]) { int flag = 0; int start, end; char rev[MAX]; // Create another string for checking. for(start=0;str[start]!='\0';start++) { rev[start] ...

24. C language help"determine palindrome"    cboard.cprogramming.com

1 #include 2 3 int main() 4 { 5 6 int number; 7 int a=/*needed number*/; 8 int x=0; 9 int y=a; 10 11 printf("Enter the set of number:"); 12 scanf("%d", &number); 13 while(z) 14 { 15 x*=10; 16 x+=z%10; 17 z/=10; 18 } 19 20 if(x==a){ 21 22 printf("The set of number is a Palindrome"); 23 24 } 25 ...

25. wat is the easiest way to create a palindrome    cboard.cprogramming.com

26. palindrome    cboard.cprogramming.com

27. five digit palindrome    cboard.cprogramming.com

Hi... I told my friend that i would help him with a problem... unfortuantely my programming skills are VERY limited. The problem requires the user to enter a five digit integer and then the program is supposed to check to see if it is a palindrome. I have searched but all of the threads are for letters and words. I don't ...

28. palindrome    cboard.cprogramming.com

29. Palindrome    cboard.cprogramming.com

#include #include #include main(){ char mes1[80],mes2[80]; printf("Enter a string here --> "); /* scanf("%s",mes1); */ getline(mes1); strcpy(mes2,mes1); reversi(mes1,mes2); printf("%s %s\n",mes1,mes2); if (strcmp(mes1,mes2) == 0) printf(" You entered a palindrome word \n"); else printf(" No, the word is NOT a palindrome \n"); } getline(m1in) char m1in[80]; { int i=0; char c; while(i<81 && (c=getchar()) !='\n'){ m1in[i]=c; ++i; } m1in[i]='\0'; ...

30. for my first real post-palindrome-newbie-sorta program    cboard.cprogramming.com

so i am a newbie...a couple of months old in this wonderful and bizarre world of programming...for my first real post-palindrome-newbie-sorta programming venture, i have been asked to write a c program that would search a file for the word 'error' and, if found, print the line # where it occured along with the time and date... so i have this ...

31. palindrome HELP !!!    cboard.cprogramming.com

palindrome HELP !!! I would appreciate it if you s could help me out on the following code. I have a piece of code, which finds if a palindrome exists on the word entered (palindrome is a string that is spelt the same way forwards as backwards) which works perfectly. However I have a file to be opened in command line ...

32. Test Palindrome    cboard.cprogramming.com

HI, My goal is to write a program to test if a particular string is a palindrome (string that's spelled the same way backwards and forwards ). Here is the code but it doesn't work, it always return false, i don'tk now why, pls tell me whats wrong, thnx in advance! Code: /* Palindrome */ #include int testPalindrome( char array[] ...

33. Problem with the palindrome    cboard.cprogramming.com

Code: #include #include int main(void){ char string[1024]; int tag, count, back, flag, loop = 1; while(loop == 1){ flag = 1; puts("Enter a word, phrase, or sentence. Or type 'END' to exit:"); for(count = 0; (string[count = getchar()) != '\n'; ++count) ; if((toupper(string[0]) == 'E') && (toupper(string[1]) == 'N') && (toupper(string[2]) == 'D')) break; tag = count - 1; ...

34. Palindrome    cboard.cprogramming.com

Here's one way of doing it..... Extra brownie points if you understand it...... lol This was written by richard heathfield,one of the authors of c unleashed.... enjoy.... Code: #include #include #include #define p void #define a sizeof #define l char #define i return #define n int #define d size_t #define r if #define o while #define m else ...

35. [Help] A problem about palindrome    forums.devshed.com

I am a beginner of C programming. I was stuck in a problem from a c-programming textbook. I appreciate if someone can help me or give me any hint. Thanks a lot!! The problem is like this ----------------------------------------------------------- Double palindrome We define a palindrome as a sequence of at least one integer that reads the same either forward or backward. ...

36. Palindrome    forums.devshed.com

I've been given an assignment to check whether a given string is a palindrome or not. I saw my book, it was quiet hard for me to understand. So, i tried a program on my way here's it //To check whether a given string is palindrome or not #include #include #include void main() { char a[30], b[30]; clrscr(); strcpy(b,a); strrev(a); if(strcmp(a,b)==0) ...

37. Reverse Palindrome    forums.devshed.com

My objective is to make the sum of a number and it's reverse to become a palindrome. For example: 17 + 71 = 88, which is a palindrome. I'm also supposed to keep count of how many times it takes for the number to actually become a palindrome. For example: 75 +57 = 132, not a palindrome, so 132 + 231 ...

38. palindrome program..please help!!!    forums.devshed.com

hi everybody, actually i ma sticked up with a problem. i need to write a program that detemine whether or not a text entered from keyboard is a palindrome. please note that a palindrome is a word, phrase or sentence that reads the same way either forward or backwards. For example, words such as noon, peep and madam are palindromes. can ...

39. Palindrome problems.    forums.devshed.com

Hello... I'm a newbie to this site but it looks promising. I have no idea how to code this. The assignment is to ask a user for a string, separated by a : In other words, the user might enter hellolleh. I'm supposed to use a stack to determine whether the two sequences of characters are the reverse (a palindrome) of ...

40. palindrome    forums.devshed.com

41. Palindrome Program HELP!!!!!!!!!    forums.devshed.com

I need to write a Lisp function that takes in one list (of atoms) and returns t or nil depending on whether the list is a palindrome or not. (i.e. "bob" is a palindrome, as is "rats live on no evil star", as is "a man, a plan, a canal, panama"). I also have to Implement the same palindrome test function ...

42. Palindrome Problem    forums.devshed.com

I am looking for palindrome code in C programming. I don't have much knowledge of C, but any help is appreciated. Here is a problem..... Write an efficient C function which modifies a string by replacing all substrings which are palindromes of nontrivial length (>1), with a given String. 1. treat all characters equally meaning don't care if they are number ...

43. Palindrome Problem Question    forums.devshed.com

Hello, I have this palindrome problem that is worded rather poorly and I'm having trouble understanding what the program is asking for. Here is what the problem says: "Replace all palindrome substrings of an input string with a given string" Has anyone come across this problem before because its too ambiguous for me? Does anyone have any examples of what a ...

44. problems with palindrome program    forums.devshed.com

There appears to be a disturbance in the Force. I am unable to read your mind. You will need to resort to more primitive means of communication, like telling us what errors you are getting. Also, please use code tags to retain your code's indentation. This Alttier's eyes cannot read unformatted code that's longer than 8 lines. PS Stupid question: you ...

45. Palindrome help    forums.devshed.com

it seems like im doing everything okay..logically. but when i execute the program it always says its a palindrome even if i input in an "abcd". can u help me. also tell me where to put the cin.get. Code: #include using std::cout; using std::cin; using std::endl; int main() { int i = 0; const int size = 80; char string1[size] ...

46. palindrome help    forums.devshed.com

47. palindrome    forums.devshed.com

Hi I'm a beginner to programming , currently I'm working on a program that determines whether a word is a palindrome or not in which a word can be spelled backwards and still remain the same ie. bob , boob etc. However If i try to compile my program,it's running without errors but ,if i try to enter the string the ...

48. palindrome for c    forums.devshed.com

hi im using c in one of my courses. ive amnaged to create i file that will split a user input into an array. that bit was easy. now the problem is creating something that will now reverse that array, compare it with the user input. if they match, obviously its a palindrome. because i wont actually have time to check ...

49. one question about my palindrome checker    forums.devshed.com

50. whether is PALINDROME    forums.devshed.com

From the Greek, "palin" means "again" and "drome" is from the verb "to run", so a palindrome is a kind of a rerun. Specifically, it is a word or sentence that is the same both forwards and backwards -- after spaces and punctuation marks are removed, of course. I don't usually play with them, but two well-known examples are: Otto Madam, ...

51. check if palindrome.    daniweb.com

#include #include int main() { const int MAX_NUM_LEN = 128; char strNumIn[MAX_NUM_LEN] = ""; char strNumOut[MAX_NUM_LEN] = ""; int num = 0; int iLen = 0; int iPos = 0; printf("Enter the number: "); scanf("%d", &num); sprintf(strNumIn, "%d", num); iLen = strlen(strNumIn); iPos = (iLen-1); /* reverse the string */ strNumOut[iLen] = '\0'; for(int i=0; i < iLen; i++) ...

52. Palindrome error!    daniweb.com

53. Palindrome    daniweb.com

It's funny because I just had to do this for my programming class. You are going to have to do a series of things. Because strings are dealt with in arrays you are going to need to remove all of the spaces and punctuation marks. (My suggestion is rather than excluding the unwanted characters, to only accept the types of characters ...

54. Palindrome program: a few questions    daniweb.com

#include #include #include void clrsp(char *); void rev(const char *,char *); int main() { char str1[80],str2[80]; printf("Enter a string: "); fgets(str1,80,stdin); str1[strlen(str1)-1]='\0'; //eliminate newline clrsp(str1); //clear spaces and punctuation marks rev(str1,str2); //reverse the string /*Use strcmp to check if two strings are same*/ if(strcmp(str1,str2)==0) printf("%s is a palindrome!\n",str1); else printf("%s is not a palindrome!\n",str1); return 0; } /*Clear ...

55. Palindrome program does not work. can some body help me fix it?    daniweb.com

th program i made does not work!!! it should input an integer between 1 and 9. and then output a palindrome. for example if i input 5, the output should be 123454321. if i input 1, it should output 1. and so on... this is the program i made: #include int main() { int n, i; printf ("Enter digit: "); ...

57. C program "palindrome"    daniweb.com

59. Palindrome help    daniweb.com

#include #include #define TRUE 1 #define FALSE 0 main () { char str[30]; int isPalindrome = TRUE; int i,j; printf("Enter a word: "); gets(str); j = strlen(str) - 1; i = 0; while(i <= j && isPalindrome) { if(str[i] != str[j]) { isPalindrome = FALSE; } i++; j--; } if(isPalindrome) { printf("%s is a palindrome!\n", str); } else { ...

60. palindrome problem    daniweb.com

#include #include #include using namespace std; const int NULA = 0; string a, b; char buff[1026]; int main (void) { while( scanf( "\n%s", buff ) == 1 ) { b = a = buff; reverse( b.begin(), b.end() ); if( a == b ) printf( "PALINDROM\n" ); else printf( "NOT A PALINDROM\n" ); } return NULA; }

61. Palindrome problem    tek-tips.com

62. palindrome problem in C    tek-tips.com

63. Write a C or C# program for palindrome generation    codeproject.com

If you are going to post your homework, at least try to make it look like you have attempted to do something yourself! We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that ...

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.