برنامه تشخیص پالیندروم یک کلمه
#include
#include
#include
const int SIZE=100;
char p[SIZE];
char v[SIZE];
//============================================ Input Function
void str_input(void)
{
cout<<"****** Programmer:VHDM ******\n-----------------------------\n";
cout<<"Enter String:";
cin>>p;
cout<<"-----------------------------\n*****************************\n";
}
//============================================ Find Input Length Function
int str_length(char p[],int tool)
{
int counter=0;
while(p[counter]!='\0')
counter++;
return counter;
}
//============================================ Revert Function
void str_revert(void)
{
for(int j=str_length(p,SIZE)-1; j>=0 ; j--)
for(int k=0 ; kv[j]=p[k];
}
//============================================ Check Function
int str_check(void)
{
int tag=0;
str_revert();
for(int i=0 ; iif(v[i]==p[i])
tag=1;
else
{
tag=0;
break;
}
if(tag==1)
cout<<"\n-------------------------------------------------------------------------------\nOK --> \'"<else
cout<<"\n-------------------------------------------------------------------------------\nSorry --> \'"<}
//============================================ Main() Function
void main()
{
str_input();
if (str_length(p,SIZE)>SIZE)
cout<<"ERROR";
else
str_check();
getch();
}