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();
}
|
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
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. |
|
|
|
![](images/spacer.gif) |
shorthair
![](http://www.members.shaw.ca/rfolz/domo-kun.jpg)
|
Posted: Fri Jan 23, 2004 11:41 am Post subject: (No subject) |
|
|
Thats cool , i had to do that in turing for a contest |
|
|
|
|
![](images/spacer.gif) |
|
|