CAS Community   >   Resources   >  

Recursive Palindromes

Program that determines whether a string is a palindrome or not. Guess what it uses.

Phil Gardner

Created by Phil Gardner
last edited Mar 22 2021 by Phil Gardner

Stop-press! I’ve added an excerpt from “Learn to Program Using C++ on the Raspberry Pi” that explains how the program works. Well alright then.

Paste C++ code into then run.

Simple C++ code will compile on a Raspberry Pi, Linux PC or Mac using the free C++ compiler g++ (part of the GNU Compiler Collection and already on your Pi). Will also compile under Windows with the Code::Blocks IDE and compiler.

Compile from an IDE such as Geany or from the command line before running.

To compile from command-line:

    Save text in a file as palsource.cpp
    g++ -o pal palsource.cpp

To run the executable from the command-line:


Uses: Functions and calls, string handling, data-types, recursion.

Level: I use this in GCSE classes, but you could demonstrate it working to Key Stage 3.

More examples on blog:

Downloaded 506 times.


This resource has attached files: to access these files, please tick the box below to assent to the license terms
License: The resources on CAS website are under Creative Commons Attribution-Share Alike 3.0 licence unless otherwise specified by the resource creators.

You must confirm that you have read and agree the licence's ToS before you can download the attachments of this resource.

I have read the licence agreement of this resource and agree to abide by its terms and conditions.

Feedback and Comments

Available when logged in (join via the front page, for free):
  • View 9 comments on this resource.
  • View resource history, links to related resources.
  • Leave feedback for the author(s), or help by editing the resource.

© 2021 BCS, The Chartered Institute for IT Registered charity: No. 292786
Using the websiteDisclaimer of liabilityCookies policyPrivacy notice