palendrom string
Author |
Message |
rickdragon
|
Posted: Tue Jan 13, 2004 2:52 pm Post subject: palendrom string |
|
|
# include <iostream.h>
# include <conio.h>
# include <string.h>
class string
{
public:
char s[100];
int a;
void getdata();
};
void string :: getdata()
{
cout<<"Enter your string :";
cin>>s;
int a,l,f,be,back;
l=strlen(s);
f=1;
be=0;
back=l-1;
while((be <= back) && f)
{
if(s[be] == s[back])
f = 1;
else
f = 0;
be++;
back--;
}
if(f)
cout<<"YES.....";
else
cout<<"NO......";
}
void main(void)
{
clrscr();
string st;
st.getdata();
getch();
}
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
Tony
|
Posted: Tue Jan 13, 2004 4:06 pm Post subject: (No subject) |
|
|
hey, it's nice that somebody is finally posting something in C++ Have some bits 8) |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
shorthair
|
Posted: Fri Jan 23, 2004 11:41 am Post subject: (No subject) |
|
|
Thats cool , i had to do that in turing for a contest |
|
|
|
|
|
|
|