[TIB] Re: [OT] C++ help


[Prev][Index][Thread]

[TIB] Re: [OT] C++ help




It's been a while, but...  How about something like this:
Len ------------ the length of the number
Bottom --------- counter from beginning
Top ------------ counter from end
IsPal ---------- will be 1 if it is a Palindrome, 0 if not
I'll leave declarations and such to you.


Len=0;
while (Pal[Len]!=NULL)
{
	Len++;
}
Len--;
Bottom=0;
Top=Len;
IsPal=1;
while (Bottom <= Top)
{
	If (Pal[Bottom]!= Pal[Top])
	{
		IsPal=0;
	}
	Bottom++;
	Top--;
}


-----Original Message-----
From: ti-basic-bounce@lists.ticalc.org
[mailto:ti-basic-bounce@lists.ticalc.org] On Behalf Of Ashley Harrison
Sent: Thursday, January 31, 2002 4:38 PM
To: ti-basic@lists.ticalc.org
Subject: [TIB] [OT] C++ help



I need some help w/ a program for c++, i need to take a six-digit number
entered by the user that could be a possible palindrome(a six digit
number that reads the same front and back, i.e. 123321, 456654), the
program has to determine if the number is a palindrome or not, and all i
can use is if/else statements and the switch statement and logical
operators, any ideas?

Chris
________________________________________________________________
GET INTERNET ACCESS FROM JUNO!
Juno offers FREE or PREMIUM Internet access for less!
Join Juno today!  For your FREE software, visit:
http://dl.www.juno.com/get/web/.





References: