Author Topic: PROGRAMMINGPEDIA  (Read 5706 times)

0 Members and 1 Guest are viewing this topic.

Offline nishantbvp

  • Member
  • Newbie
  • *
  • Points: 22
  • Posts: 39
    • View Profile
PROGRAMMINGPEDIA
« Reply #15 on: June 13, 2012, 12:39:18 am »
Quote from: techmaniac on April 11, 2012, 02:51:08 am
Quote from: techmaniac on March 31, 2012, 12:35:10 am
Quote from: coolhunnyfromdelhi on March 28, 2012, 02:41:48 am
can you provide more xamples to chk our code... about 3 or 4 more xamples..??



yejsjmnoponmghjs

answer : mnoponm

abbdbbacgh

answer : abbdbba



:O shocked,

Noone tried the Q except one ?

if u have tried then plz post the answer here, So u will get some goodies from techbits :)

 
I'll tell the logic here, correct if i am wrong.
We will write a parametrized function, say palindrome, that checks whether any string is a palindrome or not. If it is a palindrome, it will allocate the strlen value to the global variable c(by default it's 0, default value defined in main). But before that, we'll make an if condition that only if strlen value is > the value of c, c=strlen of that string. Also store the starting index value of that string passed into a global variable d.
 
Through main function, we will pass strings 1 by 1 into the function eg. from str[0] to str[1], str[0] to str[2].....str[1] to str[2].....str[8] to str[9] (Assuming the size of the string variable to be 10) using 2 for loops.
At the end of the for loops, we'll print the string character by character from str[d] to str[d+c] which will print the largest palindrome in the given string.
This is a very lengthy and tedious process, so pardon me, as I am a beginner to C programming.  :)

Offline nishantbvp

  • Member
  • Newbie
  • *
  • Points: 22
  • Posts: 39
    • View Profile
PROGRAMMINGPEDIA
« Reply #16 on: June 13, 2012, 12:39:20 am »
Quote from: techmaniac on April 11, 2012, 02:51:08 am
Quote from: techmaniac on March 31, 2012, 12:35:10 am
Quote from: coolhunnyfromdelhi on March 28, 2012, 02:41:48 am
can you provide more xamples to chk our code... about 3 or 4 more xamples..??



yejsjmnoponmghjs

answer : mnoponm

abbdbbacgh

answer : abbdbba



:O shocked,

Noone tried the Q except one ?

if u have tried then plz post the answer here, So u will get some goodies from techbits :)

 
I'll tell the logic here, correct if i am wrong.
We will write a parametrized function, say palindrome, that checks whether any string is a palindrome or not. If it is a palindrome, it will allocate the strlen value to the global variable c(by default it's 0, default value defined in main). But before that, we'll make an if condition that only if strlen value is > the value of c, c=strlen of that string. Also store the starting index value of that string passed into a global variable d.
 
Through main function, we will pass strings 1 by 1 into the function eg. from str[0] to str[1], str[0] to str[2].....str[1] to str[2].....str[8] to str[9] (Assuming the size of the string variable to be 10) using 2 for loops.
At the end of the for loops, we'll print the string character by character from str[d] to str[d+c] which will print the largest palindrome in the given string.
This is a very lengthy and tedious process, so pardon me, as I am a beginner to C programming.  :)

 

Sitemap 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49