Reader Level:

Palindrome in C# GUI

By Adarsh Acharya on Mar 13 2011
Software to check weather the word ,sentence,number are same when read from backward and forward eg Racecar,malayalam etc uses array ,first index and last index this is the one and only GUI version of palindrome available on-line checking word and sentences
    • Like
    • Love It
    • Awesome
    • Interesting
    • It's Okay
    • Thumbs Down
  • 19.1k
  • 0

You can enter any word, number, sentence(without punctuation marks) and this will give the output yes or no.


//my palindrome code

//please enter the input sentence without any symbols like ,.? etc
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Palindrome
    public partial class Form1 : Form
        int i, startchar, lastchar;
        public Form1()
        private void button1_Click(object sender, EventArgs e)
            //So that everything in lower case
            //this will avoid the error of showing Racecar as not a palindrome as r is diff from R to C#
            //RaCeCar is same as RaceCar
            string low = textBox1.Text.ToLower()
            //so that panlindrome sentence can also be chaecked
            //this will remove space in a sentence Race car int racecar
            low = low.Replace(" ", "");
            //char[] character = new char[anynumber/limit]
            char[] character = new char[100];
            character = low.ToCharArray();
            startchar = 0
            lastchar = character.Length - 1;
            while (startchar < lastchar)
                if (character[startchar] == character[lastchar])
                    //u can also use messagebox
                    label1.Visible = true;
                    label1.Text = "It is not a Palindrome";
                    button1.Text = "Try Again";
                    //so that the application does not get closed after braking the loop and u can try again
                    //this is used in the if statement after breaking the loop
                    i = 2;
            if (i < 2)
                label1.Visible = true;
                label1.Text = "It is a Palindrome";
                button1.Text = "Try Another";
                //the value is reset to 0
                //or else the application will get stucked
                i = 0;

uses array ,first index and last index 

this is the one and only GUI version of palindrome available on-line  checking word and sentences

Read Comments in C# for more details

Time pass project by me