Welcome Guest.   Make a donation to an author on the site October 22, 2014, 07:41:29 PM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
Read the Practical Guide to DonationCoder.com Forum Search Features
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1]   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: C# Palindrom Recursive Program  (Read 7340 times)
h0meopathic
Participant
*
Posts: 24

View Profile Give some DonationCredits to this forum member
« on: April 17, 2007, 09:38:11 PM »

I have to make a program using C# that makes a PalindromeTester using Recursive methods. I can make the program using normal methods i.e. while statements and nested if statements. I can't figure it out even after doing a lot of research and while looking at sudocode from someone writing it in java. Could someone help. I don't necessarily want someone to do the work for me but help me think it through using the c# language. I would talk to my Teacher about it but she can't bring herself to coming to my level. People with Ph.D's shouldn't be allowed to teach low level college classes. 
Logged
Renox
Honorary Member
**
Posts: 58


View Profile Give some DonationCredits to this forum member
« Reply #1 on: April 19, 2007, 09:42:45 AM »

Homeo, I am glad that you took my advice and registered on the forums! You'll find that the people here are EXTREMELY helpful and ALWAYS provide knowledgeable solutions...

I am put together a couple things to take a look at... I haven't really had the time to put together some coding but I have found some that has already been put into use... If you or anyone else knows java well here is some coding that will make you smile: http://www.public.asu.edu...p05/PalindromeTester.java... If anyone could convert this from Java into C# that would be wonderful... I am not too go with Java yet..

Here is a link for Recursion that you might want to look at:http://en.wikipedia.org/wiki/Recursive_algorithm

I will try to look for some more things that might be beneficial to you... If anyone else can help, please do!
Logged
tinjaw
Supporting Member
**
Posts: 1,926



I'm so glad breakbeat techno isn't an illegal drug

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #2 on: April 19, 2007, 10:04:30 AM »

h0meopathic ,

I am sure many of us here would be happy to help, but could you please help us help you?

I can make the program using normal methods i.e. while statements and nested if statements.

Attach the source code file to your posting so we can see what you have. Also attach the java pseudo code or provide a link to it.
Logged

 
h0meopathic
Participant
*
Posts: 24

View Profile Give some DonationCredits to this forum member
« Reply #3 on: April 19, 2007, 03:43:42 PM »

This is the Palindrom in non recursive format but I need to put it in recursive format. From my understanding I should put most of this code in a method, probably in another class, then have the main method call upon it every time the system loops
==========================================================
Formatted for C# with the GeSHI Syntax Highlighter [copy or print]
  1. namespace RecursivePalindromeTester
  2. {
  3.    class Palindrome
  4.    {
  5.        String str, another = "y";
  6.            int left, right;
  7.  
  8.            while (another.ToUpper() == "Y")
  9.            {
  10.                Console.Out.WriteLine("Enter a potential Palindrome:");
  11.                str = Console.In.ReadLine();
  12.  
  13.                left = 0;
  14.                right = str.Length - 1;
  15.  
  16.                while (str[left] == str[right] && left < right)
  17.                {
  18.                    left++;
  19.                    right--;
  20.                }
  21.  
  22.                Console.Out.WriteLine();
  23.  
  24.                if (left < right)
  25.                    Console.Out.WriteLine("String is Not a Palindrome.");
  26.                else
  27.                    Console.Out.WriteLine("String is a Palindrome.");
  28.  
  29.                Console.Out.WriteLine();
  30.                Console.Out.Write("Test another PalindromTester (Y/N)? ");
  31.                another = Console.In.ReadLine();      
  32.    }
  33. }
« Last Edit: April 19, 2007, 04:03:06 PM by h0meopathic » Logged
tinjaw
Supporting Member
**
Posts: 1,926



I'm so glad breakbeat techno isn't an illegal drug

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #4 on: April 19, 2007, 03:52:31 PM »

h0meopathic,

Edit your posting and use the "insert code" button and choose the proper highlighting language. That will make it look all nice and pretty, as well as make it easier for others to read.

For example:
Formatted for C++ with the GeSHI Syntax Highlighter [copy or print]
  1. String str, another = "y";
  2. int left, right;
  3.  
  4. while (another.ToUpper() == "Y")
  5. {
  6.    Console.Out.WriteLine("Enter a potential Palindrome:");
  7.    str = Console.In.ReadLine();
  8.  
  9.    left = 0;
  10.    right = str.Length - 1;
  11.  
  12.    while (str
Logged

 
kyrathaba
N.A.N.Y. Organizer
Honorary Member
**
Posts: 3,010



while(! dead_horse){beat}

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #5 on: April 19, 2007, 08:43:16 PM »

A few months ago I started a project that uses recursion to search for all files in a directory, and all files in each subdirectories, and any files in subdirectories of those subdirectories ... ad nauseum.  I haven't finished it, but what's there, works.  Might help, because shows an example of C# code for recursion.

http://www1.webng.com/bow...de/RecursiveDirSearch.zip
Logged

Win 7 Home Premium 64bit-SP1 AMD Athlon II X2 220 Socket AM3 (938) @ 2.1GHz 6GB RAM Firefox 26.0
_________________________________________________________________________________________

I'm fighting against patent trolls. Join me and tell your representative to support the #SHIELDAct: https://eff.org/r.b6JJ /via @EFF

My DC page: http://kyrathaba.dcmembers.com | My blog: http://williambryanmiller.com/ | Proofreading Service: http://bit.ly/1fQSqQP

tinjaw
Supporting Member
**
Posts: 1,926



I'm so glad breakbeat techno isn't an illegal drug

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #6 on: April 20, 2007, 06:13:57 PM »

A couple of hints.

  • Your recursive function is going to be built around the part of your code that is repeated. So lines 16 through 20 is what you should be looking at.
  • There has to be some test to know when to stop recursing. So lines 16 through 20 should be where you look.
  • In order to do recursion you need a section of code to call itself, so put it in a function.

How's your progress?
Logged

 
jeremejazz
Supporting Member
**
Posts: 58


hey!

View Profile WWW Give some DonationCredits to this forum member
« Reply #7 on: April 06, 2009, 06:04:07 AM »

er.. can i post a C Program version?... its C language also right?...  embarassed

cool.. my classmate also used a recursion in his palindrome..
Logged

smiley I love coding
nosh
Supporting Member
**
Posts: 1,388


View Profile Give some DonationCredits to this forum member
« Reply #8 on: April 06, 2009, 07:33:14 AM »

- Post deleted.
« Last Edit: April 06, 2009, 07:42:41 AM by nosh » Logged
Pages: [1]   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.055s | Server load: 0.08 ]