C++ Help

lilmaniac2
5,000+ posts

Ask Me about SI Mag V4!
Alrighty my fellow caraudio friends I come to you with a problem.

I have to test for a palindrome using a recursive function. Here is my current gode

beg is passed in as 0, mod does nothing.

Code:
bool testp (string testof, int length, int beg,int mod) 
     { 
     cout<<beg<<"     "<<length<<endl; 
     if (beg>=length) 
        return true; 
     else 
         { 
         if (testof[beg]!=testof[length]) 
            return false; 
         else 
             testp(testof,length-1,beg+1,mod); 
         } 
     }
 
Shit son, If you asked me this about a year ago... I would have had it knocked out in 5minutes.

But, you don't use it... ya lose it. It's simple though, I just think you're going about it a different way than I would have.

nG

 
fixed it,logic was fine. problem was in my main program. that code is perfect.

I normally wouldnt do it this way, but i had to do it recursively in as few lines of code as possible

 
shit, i took C++ last year in highschool

made a program for determining port sizes

all that shit

dice rolling programs for D&D

all that fun shit

and some semi-useful shit

some text based games too

too bad all of it got erased when the school's network got butt****ed over the summer

C++ was fun but its pretty much a dead coding language

alot of highschools dont even teach it anymore

learn java

 
Activity
No one is currently typing a reply...

About this thread

lilmaniac2

5,000+ posts
Ask Me about SI Mag V4!
Thread starter
lilmaniac2
Joined
Location
Somewhere, Else
Start date
Participants
Who Replied
Replies
22
Views
436
Last reply date
Last reply from
ngsm13
design.jpeg

WNCTracker

    May 22, 2026
  • 0
  • 0
IMG_2118.jpeg

WNCTracker

    May 22, 2026
  • 0
  • 0

New threads

Top