Computer Science Canada

palendrom string

Author:  rickdragon [ 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();
}

Author:  Tony [ Tue Jan 13, 2004 4:06 pm ]
Post subject: 

hey, it's nice that somebody is finally posting something in C++ Very Happy Have some bits 8)

Author:  shorthair [ Fri Jan 23, 2004 11:41 am ]
Post subject: 

Thats cool , i had to do that in turing for a contest


: